Skip to content
Advertisement

Tag: matplotlib

Matplotlib – adding subplots to a subplot?

I’m trying to create a figure that consists of a 2×2 grid, where in each quadrant there are 2 vertically stacked subplots (i.e. a 2×1 grid). I can’t seem to figure out how to achieve this, though. The closest I’ve gotten is using gridspec and some ugly code (see below), but because gridspec.update(hspace=X) changes the spacing for all of the

Python Scatter Plot with Multiple Y values for each X

I am trying to use Python to create a scatter plot that contains two X categories “cat1” “cat2” and each category has multiple Y values. I can get this to work if the number of Y values for each X value is the same by using this following code: but as soon as the number of Y values for each

Arrow on a line plot with matplotlib

I’d like to add an arrow to a line plot with matplotlib like in the plot below (drawn with pgfplots). How can I do (position and direction of the arrow should be parameters ideally)? Here is some code to experiment. Thanks. Answer In my experience this works best by using annotate. Thereby you avoid the weird warping you get with

Histogram with Boxplot above in Python

Hi I wanted to draw a histogram with a boxplot appearing the top of the histogram showing the Q1,Q2 and Q3 as well as the outliers. Example phone is below. (I am using Python and Pandas) I have checked several examples using matplotlib.pyplot but hardly came out with a good example. And I also wanted to have the histogram curve

How to create groupby subplots in Pandas?

I’ve got a dataframe with timeseries data of crime with a facet on offence (which looks like the format below). What I’d like to perform a groupby plot on the dataframe so that it’s possible to explore trends in crime over time. I’ve got some code which does the job, but it’s a bit clumsy and it loses the time

Plotting a NACA 4-series airfoil

I’m trying to plot an airfoil from the formula as described on this wikipedia page. This Jupyter notebook can be viewed on this github page. The result looks like . I expected it to look more like . Questions: Why is the line not completely smooth? There seems to be a discontinuity where the beginning and end meet. Why does

Advertisement