Dear Stackoverflow community
I have a plot of components. Would it be possible to plot values (e.g. operating times) on y-axis instead of relative changes. Kind help is greatly appreciated. Thank you
model = Prophet()
model.fit(df)
future = model.make_future_dataframe(periods=120, freq='D')
model.plot(forecast)
[model plot components](https://i.stack.imgur.com/T1LqA.png)model.plot_components(forecast)
Please help to plot y-axis with values of variable (e.g. operating times). Thank you
Related
I have this plot
I want this plot to be inverted i.e the categories with the highest avg buyer365 should appear at the top. Does anyone know how to deal with this? I really appreciate any help you can provide.
P.S code I used:
fig,axs=plt.subplots()
axs.scatter(trace1_summary["mean"],trace1_summary["cat3_items"])
axs.set(xlim=(-3,15),title= "89% Hdi Interval",ylabel="categories", xlabel="avg buyer365(standarized)")
axs.axvline(0.0,ls="--",color="k",alpha=0.5,label="average Buyer")
plt.legend()
You can plot the sorted in ascending order values:
axs.scatter("mean", "cat3_items", data=trace1_summary.sort_values("mean"))
I've been learning how to use Cartopy and Matplotlib to plot map. But I have a question regarding the argument transform. According to the Cartopy document, transform specifies "what coordinate system your data are defined in". Suppose I am going to plot temperatures of an area, and the area has been split into several grid cells. Each grid cells has a corresponding coordinate defined in lat and lon (Geodetic Systems). Based on the Cartopy document, I need to use crs.PlateCarree() instead of crs.Geodetic(). I'm a bit confused about it. Because,I think the PlateCarree is a way of projection. In other words, coordinates defined in PlateCarree projections are projected data. But latitude and longitude should be unprojected data. Can anyone help me with it? Thanks!
I am attempting to plot a histogram where the y-axis should be the count and the x-axis (i.e. the bins) should be composed of all the countries, but I cannot seem to figure out the code.
I have tried following https://datasciencelab.wordpress.com/tag/pandas/ and How to create Histograms in Panda Python Using Specific Rows and Columns in Data Frame, but both of those are for bar graphs and not for histograms.
per_country = df.groupby(['COUNTRY'])[['TOTAL']].sum()
per_country = per_country.sort_values('TOTAL')
per_country.head()
medals_per_country['TOTAL'].plot(kind='hist') # if hist is changed to bar, then it works, but I need a histogram and not a bar graph
The result should be a histogram where the x-axis includes a label for each country and the y-axis is the total for each country. Right now the bins are just based on the 'TOTAL', whereas the y-axis is the number of countries with said 'TOTAL'.
Can someone please point me in the right direction? Thank you!
I want to make 21 subplots using the matplotlib. In some of the plots, fonts of axis are overlapping on the X-axis but X-axis labels are OK. For example, X-axis of one plot has value of (0,10,2) and adjoining plot has value of (0.001,0.010,0.002) so in subplots, 10 (on first X-axis) is overlap with 0.001 (X-axis of adjoining plot). If any one know about it then please reply me.
Many thanks
-Viral
A few things you can try:
Adjust subplots so that there is more wspace and hspace
Adjust xlim/ylim manually to make sure there's no overlap (tricky)
Use tight_layout (see this question)
I get a histogram picture in matplotlib which looks great. Now I realize I need a log scale on the y-axis, so I just add to the code:
ax.set_yscale('log')
but then, the histogram bars dissapear and I only get some sparse points, do you know waht could be the reason?
Thanks
Use hist's log=True keyword argument instead. This is a FAQ in matplotlib-user list :)