I am making a matplotlib animation in which a quiver arrow moves across the page. This cannot be achieved in the usual way (creating one Quiver object and updating it with each frame of the animation) because although there is a set_UVC method for updating the u, v components, there is no equivalent method for changing the x, y position
Tag: matplotlib
How to plot multiple lines in one figure in Pandas Python based on data from multiple columns? [duplicate]
This question already has answers here: Plotting multiple lines, in different colors, with pandas dataframe (6 answers) Closed 1 year ago. I have a dataframe with 3 columns, like this: how can I plot a line for A, B and C, where it shows how their weight develops through the years. So I tried this: However, I get multiple plots
How to get the x and y intercept in matplotlib?
I have scoured the internet and can’t find a python command to find the x and y intercepts of a curve on matplotlib. Is there a command that exists? or is there a much easier way that is going over my head? Any help would be appreciated. Thanks, Nimrodian. Answer
matplotlib histogram: how to display the count over the bar?
With matplotlib’s hist function, how can one make it display the count for each bin over the bar? For example, How can we make the count in each bin display over its bar? Answer it seems hist can’t do this,you can write some like :
How to use Basemap (Python) to plot US with 50 states?
I am aware that the powerful package Basemap can be utilized to plot US map with state boundaries. I have adapted this example from Basemap GitHub repository to plot 48 states colored by their respective population density: Now my question is: Is there a simple way to add Alaska and Hawaii to this map and place those at a custom
How to plot a figure with Chinese Characters in label
When I draw a figure with Chinese Character label in Python 3, it doesn’t work correctly: ] My code: Answer You need to explicitly pass the font properties to legend function using the prop kwag: Source
How to add custom annotations, from the dataframe, to a stacked bar chart?
I’m plotting a cross-tabulation of various offices within certain categories. I’d like to put together a horizontal stacked bar chart where each office and its value is labeled. Here’s some example code: This gives me a fine starting point: However, what I’d like to have is this: After some research, I came up with the following code that correctly lines
Adjusting gridlines and ticks in matplotlib imshow
I’m trying to plot a matrix of values and would like to add gridlines to make the boundary between values clearer. Unfortunately, imshow decided to locate the tick marks in the middle of each voxel. Is it possible to a) remove the ticks but leave the label in the same location and b) add gridlines between the pixel boundaries? Image
Why is matplotlib’s notched boxplot folding back on itself?
I tried to make a notched boxplot using matplotlib, but found the notched box tends to overextend and then fold back on itself. This does not happen when I make a regular boxplot. This can be seen with the following code and the resulting plot that gets generated: Does anyone know what I’m doing wrong and how I can fix
Matplotlib boxplot visual styles: `whiskerprops` does not work
In the documentation of matplotlib’s boxplot we can read: whiskerprops : dict or None (default) If provided, will set the plotting style of the whiskers Ok, so I passed a dict to set some visual styles on the whiskers: The settings have no effect, except the color. Same behaviour could be observed at the other props: capprops, medianprops, boxprops, etc.