我正在尝试绘制这样的数据,
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import glob
import os
dfp = pd.read_csv('/home/foo/file.csv', sep=',', encoding='utf-8')
ax = plt.subplot(111)
ax.plot(dfp['col3'], dfp['col2'], ls = '-', color='red', marker='x', markersize = 25.0)
ax3.set_xticks(pf['col3'])
ax.errorbar(dfp['col1'], dfp['col2'], yerr=dfp['PN_6_FLUX_ERR'], ls='None', marker = '.')
ax.set_xlim((dfp['col1'].min()-0.1*(dfp['col1'].max()-dfp['col1'].min())), ((dfp['col1'].max()+0.1*(dfp['col1'].max()-dfp['col1'].min()))))
ax.set_ylim((dfp['col2'].min()-dfp['col2'].max()),((dfp['col2'].max()/2.0)+dfp['col2'].max())
ax.grid()
plt.xticks(dfp['col1'])
plt.yticks(dfp['col2'])
plt.xlabel('col1')
plt.ylabel('col2')
plt.title('col1 vs. col2')
plt.show()
我的结果是:
我希望获得col2的最大值,并将col3中相关值的x tick标签更改为' 0'。像这样: