Category "matplotlib"

Obtaining the exact data coordinates of seaborn boxplot boxes

I have a seaborn boxplot (sns.boxplot) on which I would like to add some points. For example, say I have this pandas DataFrame: [In] import pandas as pd

Correct placement of colorbar relative to geo axes (cartopy)

Using Cartopy, I would like to have full control of where my colorbar goes. Usually I do this by getting the current axes position as basis and then create new

Remove legend key in matplotlib

I want to show a legend text but without a key (the rectangular box or line that appears by default). plt.hist(x, label = 'something') I don't want the bo

Python hide ticks but show tick labels

I can remove the ticks with ax.set_xticks([]) ax.set_yticks([]) but this removes the labels as well. Any way I can plot the tick labels but not the ticks a

save multiple objects to zip directly from memory

I'd like to save multiple objects, e.g. figures, created in a loop directly to a zip file, without saving them in directory. At the moment I'm saving the figure

3D 3-body motion simulation

I am trying to use the velocity Verlet to simulate the 3-body problem. I am 95% sure that I gravitational force formula and the velocity Verlet algorithm is cor

How to mantain aspect ratios after overlay in geopandas?

I'm trying to overlay some cities on top of a map. import pandas as pd import geopandas as gdp import matplotlib.pyplot as plt from shapely.geometry import box

Preserve padding while setting an axis limit in matplotlib

Setting xlim and ylim for axis in pyplot removes the padding. How to set them without changing the padding? Example: fig, ax = plt.subplots() x = np.linspace

Using `matplotlib` to plot - <Figure size 432x288 with 0 Axes>

I've a huge data set with 158 columns and 3.1 million rows. I'm trying to plot univariate distibutions for that data set. Code is as given below. dtf = pd.read_

python animation.FuncAnimation error : object is not iterable

I'm new to Python and now studying matplotlib to use animation function. I'm following qutip tutorial because of my study. But when I copied and pasted example

Matplotlib not saving axes on savfig

This code only saves this image. As you can see it's rather empty :| Where are my axes plots? start = 100 sim_rets = gbm( mu=m.mu, n_scenarios=m.scenari

Row and column headers in matplotlib's subplots

What's the best practise to add a row and a column header to a grid of subplots generated in a loop in matplotlib? I can think of a couple, but not particularly

Setting plot background colour in Seaborn

I am using Seaborn to plot some data in Pandas. I am making some very large plots (factorplots). To see them, I am using some visualisation facilities at my u

Setting plot background colour in Seaborn

I am using Seaborn to plot some data in Pandas. I am making some very large plots (factorplots). To see them, I am using some visualisation facilities at my u

Time series dBFS plot output modification - current output plot not as expected (matplotlib)

I'm trying to plot the Amplitude (dBFS) vs. Time (s) plot of an audio (.wav) file using matplotlib. I managed to do that with the following code: def convert_to

How do I change the backend in CoCalc to show a matplotlib scatter graph?

I have a program that is working fine locally, but I need to use it in CoCalc on the cloud to share with a group. Everything works fine until the end, when I wa

Scientific tick label notation tuning

I am not completely satisfied with the default scientific formatting for the tick labels. For example, import numpy as np import pylab pylab.rcParams['text.us

Uneven coordinates in astropy Cutout2D image plot

I am using astropy to download and plot images from the SDSS database. Also I am using the Cutout2D function to cut a 10x10 arcsec square around the object I am

How to add custom annotations to a stacked bar

I am trying to annotate a stacked histogram in Seaborn with the hue for each segment in the histogram for readability reasons. I've attached sample data below a

PyQt GUI size on high resolution screens

I posted a question a while ago asking about Tkinter backends and subsequently forgot about it but I've since realised that I'm using the pyqt backend. Is there