Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
8 views

How to put y-axis label on left side with plt.tick_params?

I see lots of examples putting y-axis label and ticks with ax.yaxis.set_label_position("right") ax.yaxis.tick_right() but I can't find any examples doing the same thing with plt.tick_params....
Redshoe's user avatar
  • 127
0 votes
0 answers
17 views

Python->Subplot-> Move Span center to click position not showing range when clicking in subplot with shown range

I have created a 2 plot subplot. Selecting the range in both subplots works fine. Clicking into the upper subplot (the zoomed plot) shifts both views fine, but when clicking in the lower (total view) ...
GvTT's user avatar
  • 11
0 votes
0 answers
16 views

How do I update a matplotlib plot in realtime and also have a REPL?

I am in a situation where I have a primitive REPL with some simple commands. These commands generate data and put the data into a threadsafe queue. I then have a function that takes the data from the ...
Angelo's user avatar
  • 3,113
0 votes
1 answer
20 views

Horizontal and vertical colorbars on a single plot in python

I have KDE plot generated using seaborn on which I overlay some scattered points with some size. I need to have two colorbars to represent the data of KDE and the scattered values's size (as shown ...
skm's user avatar
  • 5,629
0 votes
1 answer
33 views

Scatter plot showing data points with negative values when there are no negative values in the dataset

Having an issue with this linear regression prediction model. The scatter graph is showing data points well into the negative when there are no negative values within the data set. I've checked the ...
leakie's user avatar
  • 1
0 votes
2 answers
33 views

Draw a Venn-diagram in python with one large area encompassing all other

I used so far succesffully this code: import matplotlib.pyplot as plt from matplotlib_venn import venn2 # Define the areas for the Venn diagram area1 = 13552 # Area of the left ellipse area2 = 7887 ...
NeStack's user avatar
  • 1,984
-1 votes
0 answers
16 views

Coverting Mathematical Equations to a custom font [closed]

When we copy any mathematical equation from anywhere, they get converted to a Latex Code(which is not readable), when we paste it. I am able to convert that latex code to a readable form using ...
dovbyk's user avatar
  • 1
0 votes
0 answers
18 views

How to resize figure to fit window on event in matplotlib?

I've already got help with this problem, but stuck again. I'm trying to pre-generate and store matplotlib figures in python, and then display them on a keyboard event (left-right cursor keys). It is ...
lmocsi's user avatar
  • 1,086
2 votes
1 answer
29 views

How to increase the space between the subplots and the figure?

I'm using a python code to plot 3D surface. However, the z-axis label get cut by the figure. Here is the code : import matplotlib.pyplot as plt import numpy as np fig = plt.figure(figsize=(12, 10), ...
user28754841's user avatar
0 votes
0 answers
29 views

Three plots sharing x-axis on top of each other as in figure

I'm struggling with matplotlib. I'd like to get a plot like this one but with the code below I can only get this plot. f, (ax1, ax2, ax3) = plt.subplots(3, sharex=True, sharey=False) ax1 = plt.gca() ...
user123892's user avatar
  • 1,293
1 vote
1 answer
25 views

Python: Plotting a Basemap in the x-y-plane of a 3d plot

I am trying to get the code contained in https://basemaptutorial.readthedocs.io/en/latest/basemap3d.html to work. However, I get an error already in the first snippet: import matplotlib.pyplot as plt ...
ahul-fell-awen's user avatar
0 votes
0 answers
27 views

MatPlotLib FuncAnimation: Is there a way to show the gif as it saves?

I am currently experiencing an issue where I can either run an animation in Jupyter Notebook, or I can save it, but I can't do both. If I want to do both, I have to run the code twice, once with: ani....
lzzard's user avatar
  • 53
2 votes
1 answer
33 views

Mismatch between the volume shape and the axes grid in matplotlib

I have written a script to visualize a 3D volume using Matplotlib. The decay volume is explicitly centered at x = y = 0, but the grid displayed appears displaced relative to the volume. This seems to ...
McAddams's user avatar
0 votes
0 answers
34 views

How to speed up secondary_xaxis() in matplotlib? [closed]

I'm finding usage of secondary_xaxis() is extremely slow. I'd like to speed it up. To add a secondary axis at the top of the plot, I'm passing two functions to secondary_xaxis() both of which just ...
hjs's user avatar
  • 133
0 votes
0 answers
23 views

Matplotlib: making subscripts italicized

I'm using plt.text to display some texts in my figure. I want the whole text to be italicized, including subscripts. I've tried a number of ways and I just can't get the subscript to be italicized. ...
Barry Zheng's user avatar
2 votes
1 answer
40 views

matplotlib pretty print function for numbers [duplicate]

I'm trying to have some nice titles and annotation in matplotlib plots. For instance, I want to convert a number like 1e-3. in a katex/latex syntax : $1 \cdot 10^{-1}$, which will nicely appears on ...
Marti's user avatar
  • 89
0 votes
2 answers
53 views

How to enable automatic color cycling for Arc patches in matplotlib?

In this Python 3.12 script: import matplotlib.pyplot as plt from matplotlib.patches import Arc fig, ax = plt.subplots() for a1 in range(0, 360, 20): ax.add_patch(Arc((0, 0), 10, 10, theta1=a1, ...
Paul Jurczak's user avatar
  • 8,041
2 votes
2 answers
54 views

python: heatmap with categorical color and continuous transparency

I want to make a heatmap in python (seaborn, matplotlib, etc) with two dimensions of information. I have a categorical value I want to assign to color, and a continuous variable (i.e. between 0-100 or ...
andbeonetraveler's user avatar
0 votes
1 answer
61 views

Varying the arrowsize proportional to the linewidth in streamplots (matplotlib: 3.5.1)

I have fluid flow data, that has some vortices that decay in strength with distance in one direction. An easy example of this is below. import numpy as np # model flow field x = np.linspace(0, 2 * np....
vercors's user avatar
  • 21
1 vote
0 answers
53 views

Why can't Python find Matplotlib after installing Manim (in Windows 11)?

I am using Windows 11 on an HP laptop, purchased August 2024. I have installed Python, then added matplotlib (using the command line from PowerShell) and it seemed to be working (In PowerShell I ...
demneptune's user avatar
2 votes
2 answers
43 views

How to adjust the size of one subplot independently of other subplots in a matplotlib figure?

I want to have horizontally aligned 3D and 2D plots, where the y-axis of the 2D plot is the same height as the z-axis of the 3D plot. The following code produces a default output: import matplotlib....
Corvus's user avatar
  • 37
0 votes
1 answer
38 views

FuncAnimation only shows one frame

I am trying to implement a genetic algorithm in Python and to display the result of my algorithm I wanted to create an animation using FuncAnimation from matplotlib.animation. However, I ran into the ...
Andrew's user avatar
  • 45
0 votes
1 answer
47 views

How can I make a density plot with log-scaled axes in matplotlib?

I want to plot a scalar density as a function of two variables x and y, which can potentially be scaled logarithmically. I essentially run simulations for each pair of x and y and want to report the ...
David Zwicker's user avatar
0 votes
1 answer
35 views

matplotlib x axis not as expected

I want the x-axis labels to be exactly as in the file, but it's converting them. Also, I don't want the thick black line above the labels. And, I'd like the plot to extend fully to both sides of the ...
Mike's user avatar
  • 701
0 votes
1 answer
49 views

Visualization of ranking models based on time executions

I'm working on reproducing the following plot for my own case: so, let's say I already have my results ready and in the form of data frames as below: import pandas as pd # Data data1 = { 'Models'...
Mario's user avatar
  • 1,962
3 votes
1 answer
55 views

Plotting quiver plots in matplotlib

I want to plot the slope field for: 0.5*sin(0.5*pi*x)*sqrt(y+7) import numpy as np import matplotlib.pyplot as plt # Specify the grid of dots x = np.arange(-3,3,0.3) y = np.arange(-2,4,0.3) X, Y = ...
blackened's user avatar
  • 903
0 votes
0 answers
25 views

'Arrow3D' object has no attribute 'do_3d_projection'; set up X, Y, Z axis on 3D plane

The purpose of the code is to use arrow3D to initiate X, Y, Z axis on a 3D plane. The parameters of arrow3D are x, y, z, which default to zero; and dx, dy, dz, which is the length of X, Y, Z axis. ...
H.Li's user avatar
  • 33
0 votes
1 answer
32 views

changing the y axis in matplotlib

How can you change the y-axis in matplotlib such that you have specified ticks ([0, -1, -8, -44, -244]) but they are evenly spread over the y-axis (the gap between 0 and -1 is just as big as the gap ...
Max's user avatar
  • 3
0 votes
1 answer
44 views

How to sample point using LatinHyper Cube sampling in a random volume

I have a a dataset composed of XYZ coordinates, which can be rendered in 3D bar chart as the picture below. The main question I have is: how to generate X points (X being a user input) inside said ...
Ryderc's user avatar
  • 109
0 votes
2 answers
60 views

Edit legend of seaborn stacked barplot

I followed this tutorial to create a stacked double barplot, which worked nicely for my data, but now I'm trying to edit the legend to include the information needed to read the figure. I tried ...
Whitehot's user avatar
  • 487
1 vote
1 answer
21 views

Determine if matplotlib figure is still displayed (has not been closed)

When using matplotlib in interactive mode, I need to know, whether a figure has been closed or not. I'm tracking the figure handles for other purposes, but the event of closing the figure is decoupled ...
Martin Matoušek's user avatar
1 vote
1 answer
75 views

Problems plotting timestamps on the x-axis with Matplotlib

I am working on a Python script that loads several CSV files containing timestamps and ping data and then displays them on a plot. The X-axis is supposed to display the timestamps in HH:MM format, ...
Pantastix's user avatar
  • 340
0 votes
1 answer
51 views

Value Error can only convert an array of size 1 to a Python scalar

I want to plot a heatmap centered around a value of 1 showing the expression of genes corresponding to cell lines using this as code: import pandas as pd import numpy as np import matplotlib.pyplot as ...
Deichgraf's user avatar
-3 votes
0 answers
37 views

How to plot a histogram from a 32 byte HEX String [closed]

I want to plot a RBC Histogram from a 32 byte hex string sent by an healthcare instrument over HL7 protocol. The String - OBX|2|NM|RBCHistogram^LeftLine||28||||||F|||||administrator| OBX|2|NM|...
YASH 's user avatar
0 votes
1 answer
30 views

selecting a contour from multiple contours of same level

I'm Trying to obtain the contour at a given level, say 23 C from a time vs depth data of temperature. The contour 23 is overlaid onto the figure. How do I isolate and select one single contour path ...
Ranjan Kumar Sahu's user avatar
2 votes
1 answer
87 views

Why is the plot of the refractive index wavelength-dependent Fresnel's equation not showing as expected?

I want to reproduce the reflectance spectrum of a thin film whose complex refractive index is wavelength-dependent (the complex refractive index data, named N2 in code, can be obtained from here). ...
Pxndx's user avatar
  • 23
0 votes
0 answers
25 views

Place a ring on a cartopy plot projection

I want to place a ring on a map project. I would like to set the inner and outer radius and place the center anywhere I want. The needed imports: import cartopy import cartopy.crs as ccrs from cartopy ...
c186282's user avatar
  • 101
0 votes
1 answer
25 views

Matplotlib does not consistently transform plotted elements with plt.xscale('log')

When plotting data, vertical line gets incorrectly transformed by matplotlib. With linear x axis, my curve and the vertical line pointing to a specific location on the curve match perfectly. After ...
Dr. Hillier Dániel's user avatar
1 vote
1 answer
36 views

Plot contours from discrete data in matplotlib

How do I make a contourf plot where the areas are supposed to be discrete (integer array instead of float)? The values should discretely mapped to color indices. Instead matplotlib just scales the ...
ascripter's user avatar
  • 6,205
0 votes
0 answers
21 views

Stack 2d heatmaps on top of each to create 3d tomography plot in python [duplicate]

I am trying to understand how to create 3D tomography plots in python. I have created a list of correlation matrices, and I want to plot each correlation matrix as a 2d heatmap, where the color ...
KirkLab's user avatar
  • 19
-1 votes
2 answers
43 views

Python Matplotlib - How to plot a grouped bar chart

Suppose I already have the following labels list and data dict: labels = ["Label 1", "Label 2", "Label 3", "Label 4", "Label 5"] data = { "...
HelloVictor2000's user avatar
0 votes
1 answer
28 views

Put specific name on plt.title using DataFrame

I want to plot a graph with the column name in the title. For example: import pandas as pd begin_date = '2019-01-01' df = pd.DataFrame ({"date": pd.date_range(begin_date, periods=5), &...
Daniel M M's user avatar
0 votes
1 answer
23 views

Extend a 3d plot to the edge of a figure with matplotlib

The following code results in a figure saved with large white spaces around it, while there is enough space to stretch the axes. import matplotlib.pyplot as plt import numpy as np X = np.arange(-5, 5,...
Liris's user avatar
  • 1,501
0 votes
0 answers
9 views

How can I recover the italic style in equations with TeX Gyre Pagella Math font?

I'm currently preparing figures with matplotlib and I have set the font to Tex Gyre Pagella by modifying my .mplstyle file. Everything is now rendered using the font, but the symbols in equations do ...
Diego's user avatar
  • 184
0 votes
0 answers
23 views

Either incorrect spacing or incorrect size using matplotlib shared y axis and aspect equal

Context I'm trying to display some timing data of differing algorithms which depend on some input size and another parameter. The goal is to have n plots showing the various algorithms and one summary ...
Sam Coutteau's user avatar
0 votes
0 answers
25 views

Geopandas plot: Image size of 833x81232 pixels is too large. It must be less than 2^16 in each direction

I am plotting a global choropleth map in Jupyter Notebook displaying each country's share of electricity production from fossil fuels (%). I managed to plot the original shapefile on a map, so I know ...
Della's user avatar
  • 1
0 votes
1 answer
29 views

Show frequency in a violin plot

I'm using matplotlib's violinplot and I'd like to see the frequency values in the X axis. This is my MWE: import numpy as np import matplotlib.pyplot as plt data = np.random.normal(size=100) plt....
Didac Busquets's user avatar
0 votes
0 answers
51 views

How to substitute variables in a Python raw string? [duplicate]

I want the code snippet below to output a plot, with fraction 2.345 / 3.456 to be rendered using latex at the point (0.1, 0.9). I'm using python raw string along with f-strings in the call to ...
chelwin's user avatar
  • 13
2 votes
2 answers
54 views

How to save a matplotlib figure with automatic height to pdf

I have the following problem: I want to save a figure with a specific width, but auto-determine its height. Let's look at an example: import matplotlib.pyplot as plt import numpy as np fig,ax=plt....
Simon Schey's user avatar
2 votes
1 answer
57 views

How can I reduce the spacing between vertical lines (vlines) in Matplotlib?

I'm creating a plot in Matplotlib where I display vertical lines (similar to bars). However, I can't manage to reduce the spacing between these lines. No matter which parameters I change, the lines ...
Samuel Vranici's user avatar

1
2 3 4 5
1457