0

I am new in python and I am using code from here to plot the mean and std:

df = pd.read_csv('file.csv')
x = df['index']
y = df['mean']
e = df['std']

plt.figure(figsize=(18, 6))
plt.errorbar(x, y, e, linestyle='None', marker='^')
plt.xticks(x, rotation=45)
plt.xlabel('test', fontsize=16)
plt.ylabel('size', fontsize=16)
plt.tight_layout()

Now the code from here givinng me this image: current format I want to rotate the plot 90 degree to be like (the x and y lable is also need to rotate): desire format

Bilgin
  • 499
  • 1
  • 10
  • 25
  • It's not straight forward to rotate a plot, but maybe you just want to plot the transposition, i.e. `plt.errorbar(y,x, xerr=e)`? – ImportanceOfBeingErnest Aug 13 '19 at 13:50
  • Did you see [this](https://stackoverflow.com/questions/22540449/how-can-i-rotate-a-matplotlib-plot-through-90-degrees) ? – Rex5 Aug 13 '19 at 13:51
  • @Rex5 yes, i saw that and i tried but it didnot work – Bilgin Aug 13 '19 at 13:53
  • @ImportanceOfBeingErnest I just tried your suggestion but it did not work – Bilgin Aug 13 '19 at 13:54
  • Gone through the link you mentioned but what do you mean by rotate. I mean what do you want or can you edit that image on that page and paste your requirement. Like you want your y-axis to be at the x-axis and x-axis to be at negative y-axis ? – Rex5 Aug 13 '19 at 13:59
  • 1
    "but it didnot work" is not a propper problem description. What's wrong with it? – ImportanceOfBeingErnest Aug 13 '19 at 14:00
  • @Bilgin saying "it did not work" doesn't help much, you need to be more specific about what you're actually after. as the other comments suggest, your question as stated is very ambiguous – Sam Mason Aug 13 '19 at 14:02
  • Update the problem you encountered after trying @ ImportanceOfBeingErnest 's solution in the question itself. – Rex5 Aug 13 '19 at 14:03
  • @ I updated the question. The second figure is what I want. Sorry, I do know how to reduce the size in the post. It shows really bigger in size. – Bilgin Aug 13 '19 at 14:11
  • So you want to rotate the complete graphics? That would usually better be done externally, like [rotate-images-from-terminal](https://askubuntu.com/questions/591733/rotate-images-from-terminal) or [Command line: How do you rotate a PDF file 90 degrees?](https://unix.stackexchange.com/questions/394065/command-line-how-do-you-rotate-a-pdf-file-90-degrees) – ImportanceOfBeingErnest Aug 13 '19 at 14:15
  • @ImportanceOfBeingErnest so, how about the y axis values. If I do externally, they will be hard to visualize i guess. – Bilgin Aug 13 '19 at 14:22
  • A way could be to save image in a folder, read it and rotate it with https://pythontic.com/image-processing/pillow/rotate – akhetos Aug 13 '19 at 14:23
  • You can rotate the y axis labels by 180 degrees prior to saving. But then one might ask why not use the transposition as in the first comment? – ImportanceOfBeingErnest Aug 13 '19 at 14:25

0 Answers0