Skip to content
Advertisement

Tag: matplotlib

How to plot spheres in 3d with plotly (or another library)?

I am struggling with plotting something, that I thought should be really simple. I have a dataframe/table df that contains the coordinates x,y,z of spheres. Additionally, in a separate column, it contains the radius of these spheres. How can I make with plotly a 3d plot of the spheres in space with their correct radius being used? The closest I

how to format dates on x-axis in matplotlib?

I am trying to plot average temperatures from 1960 to 2021 for the month of December from time series data. my dataframe contains mean minimum and mean maximum temperatures, as for plotting i am trying as, for formatting dates on x-axis, i am trying as, but this gives me very messy x-axis ticks (all dates from 1960-2021), but i want

Add trend line to datetime matplotlib line graph

I have a pandas dataframe df: And I can plot this easily using plt.plot: But now I want to add a trendline. I tried using some answers: How can I draw scatter trend line on matplot? Python-Pandas Which doesn’t work: Then I found the following question and answer: TypeError: ufunc subtract cannot use operands with types dtype(‘<M8[ns]’) and dtype(‘float64’) But

Fill color in single cells in a networkx graph

I’ve build a graph with networkx, that looks like this: Graph I want to fill every singel cell with a specified color. The Graph was drawn by nx.draw_networkx_edges() (returns a LineCollection). I found a similar question here (Fill area between lines), but the solution in the comments, doesn’t worked for me. I’ve also used plt.fill_between with a simpler graph and

How do I rearrange the order of pie slices in pandas plot?

I am trying to rearrange the order of the pie slices in my pie chart. I am relatively new to Python and am having trouble figuring this out. Here is my current code: The pie chart slices arrange in alphabetical order by the names of the countries, even though my dataframe is different. So, how do I change the order

Create automatic tick labels for a tkinter scale

I want to create a scale with tick labels that are automatically chosen so they fit on to the scale without interfering with each other. Here is an example code for crating one that resizes with the window: When creating a plot with matplotlib, this happens by default and even gets updated when changing the size of the plot window.

Advertisement