I am using the clustermap method in the seaborn library and I would like to have the axis labels printed in italics. I don’t think that seaborn allows me to specify the font style, so my question is, is there some way to encode italic font style into the label string? I have tried this, [r’$it{‘+i+’}$’ for i in data.columns],
Tag: matplotlib
Python – Reduce the plot axis size
I want to reduce the axis size of this diagram that I have plotted. As you see the (0.7 ; 1.0) part is useless on both axis and I want to remove them so the diagram is well centered and takes all the plot. Here is the part of my code for the plotting : Thank you ! Answer
How to replace pandas plot xticks with days?
I’ve got a pandas hist plot like shown below. As you can see the xticks are currently set to 0-6 (Sunday – Saturday). I’d like to replace the tick label to the actual days so the days are showing instead of numbers. 0 – Sunday 1 – Monday 2 – Tuesday 3 – Wednesday . . I believe there’s a
Add title to each grid with ImageGrid
I’m using matplotlib’s mpl_toolkits.axes_grid1.ImageGrid to generate two grids, each size (3,3): I’m trying to figure out how to add a title to each ImageGrid, so that there would be two titles, one for the left 3×3 grid, and one for the right one. It seems like this should be pretty straightforward, but I haven’t been able to figure it out
Plotting average linear regression of data set consisting of missing values
I was trying to plot a linear graph using m,b = np.polyfit(x0, y0, 1) function however when I print m2,b2,m3,b3 I get nan. from the empty values. How do I fix this? Answer You seem to have a typo in It would probably help to rename the variables idxy12,idxy13 and idxy14 or so. You also could write all this with
How do you remove corresponding x values of missing y-data from lists?
When I plot this graph the y-axis looks very off. Realising I need to remove the “” spaces in the list, I tried this method: This showed me a dimensional error. I don’t know how to only extract the corresponding values of x to the y values. Answer You can use pandas’ pd.to_numeric(…, errors=’coerce’) to convert each of the strings
I’m getting float axis even with the command MaxNlocator(integer=True)
I have this df called normales: With this code i’m plotting time series and bars: You can realize that i’m using ax.yaxis.set_major_locator(MaxNLocator(integer=True)) in every axis to make integer the numbers of the axis. Although i’m using ax.yaxis.set_major_locator(MaxNLocator(integer=True)) i’m getting graphics with non integer (float) values in the yaxis. Do you know why this is happening? Thanks in advance. Answer From
Matplotlib & Cartopy – How to automatically plot data with colors depending on a categorical column?
I am trying to plot ship trajectories in Cartopy, but am unable to automatically use a column of my df to set the color groups of the data. This throws the error ‘dtype: object is not a valid value for color’. In Geopandas you can set the color groups using the ‘column’ field. Is there anything similar for Matplotlib/Cartopy? Thanks
Loop through and add values to array via for loop
Morning, I am trying to add all my values of Distance and Speed to an array, so I can plot them with PLT. However, python is only appending 1 value, why? What am I doing wrong? Code and output below: ”’ output: ”’ AS you can see the array is ONLY showing Distance and same distance again, HOW do I
Surface plot for the profile
I am trying to plot the surface profile but I am getting this only. I don’t know why it’s not plotting the surface profile. Where is the mistake? Where am I going wrong ? I have already mentioned all the axes but all I am getting is the above figure. Can anybody help in figuring it out? Answer You are