I want to have some box annotations inside a plot with matplotlib. Is there a way to specify a fixed width for the textbox? I want to be able to have some random text inside my annotation that gets adjusted automatically, not to the sides, but top down. Here is a minimal example: import matplotlib ..
I have created a figure using matplotlib and saved it using savefig function. following is the code i used, import matplotlib.pyplot as plt x = [0, 2, 4, 6] y = [1, 3, 4, 8] plt.plot(x,y) plt.xticks(), plt.yticks() plt.box(False) plt.savefig(‘plot.png’) plt.show() When i run the following code in google colabs it generates an image with ..
I’m trying to set a seaborn palette in a Python script in Spyder using this: import seaborn as sns sns.set_palette("Reds") It doesn’t really matter what palette I pass as an argument, I always get the error below: Traceback (most recent call last): File "<ipython-input-20-efc46ee41836>", line 1, in <module> sns.set_palette("Reds") File "c:userslucas-magalhaesanaconda3libsite-packagesseabornrcmod.py", line 550, in set_palette ..
My data needs to be plotted on a log scale in order to be able to see some of my really small values, however, I can’t seem to find any way to do it on a 3D bar plot. Supposedly in a 2D bar plot you can adjust the scales by simply including ax.set_zscale(‘log’) in ..
I have sorted the sectors based on the price earning ratio. Now, I need to make a pie chart of Sectors sorted by top 20 price earnings ratio. Example- IT(6/20)-30% data.head() pe = data.sort_values(by=’Price/Earnings’, ascending=False) pedf = pd.DataFrame(pe) pedf20 = pedf.head(20) plt.figure(figsize=(10, 6)) plt.title("Sectors with highest pe ratio") Source: Python..
I am working on a website that would allow users to plot data and style the graph as necessary. The problem I am having is that a lot of the style properties are built into the sns.(plot) function and are difficult to customize based on a user’s input. What I would like to do is ..
I would like to draw 3D geometry drawings of this type: https://en.wikipedia.org/wiki/Spherical_coordinate_system#/media/File:Spherical_coordinate_system.svg But I want to be able to 3D rotate/pan/zoom like you normally can with matplotlib, and I want the result to be with this flat aspect, like paper illustrations. Rotation and panning would help me study a problem from multiple view angles and ..
It is my first question on stackoverflow, if I am missing some data, they tell me, What I need is to create a function graph with the python language but I do not find information on how to do it, I find how to make the graphs but not the limits of the functions What ..
I have a pie chart that has too many categories that make it impossible to read. Is there a way to group the smaller values, say anything under 4% into an "Other Category?" Currently,. it’s impossible to read the smaller values. counts = df[‘Term’].value_counts() counts.plot.pie(autopct=’%.2f%%’) plt.show() Source: Python..
The Problem I create plots with annotations in matplotlib using the pgf backend to save them as pdf files. As font family I use Fira Sans which works fine. However I am not able to change the weight to something different than bold. While I get something like with the agg backend, the pgf backend ..