72,854 questions
1
vote
1
answer
43
views
python Plot Swaps Colours in Subplot — How to make one colour stick to one data set?
I am trying to plot some data from a Markov Chain Monte Carlo run, using getDist, which (I assume) uses matplotlib under the hood for plotting. There is no error message or anything, and it produces a ...
0
votes
0
answers
90
views
3D plot of trajectory given X,Y,Z points [closed]
Im trying to plot a 3D trajectory (predicted vs ground truth) but something feels wrong, i managed to get right graphs X,Y,Z in seperate graphs , with respect to time (just seq nums basically) with ...
Best practices
1
vote
3
replies
36
views
Visualizing categorical features with severe Class Imbalance for ML: Absolute Counts vs Normalized Percentages?
I am performing Exploratory Data Analysis (EDA) on a medical dataset (Primary Biliary Cirrhosis) to select features for a multiclass classification model. My target variable is Stage (1, 2, 3, 4).
The ...
Tooling
0
votes
3
replies
46
views
How to better emulate this broken line plot with matplotlib or seaborn?
What I want to achieve is something as below:
I have found the brokenaxes package here, and tried it:
from brokenaxes import brokenaxes
import numpy as np
bax = brokenaxes(xlims=((0, 10), (195, 200))...
1
vote
1
answer
61
views
how to carryon after matplotlib has been called
I am stuck after displaying using matplotlib because I can not seem to figure out what code to use to continue after using matplotlib. Specifically, I use:
plt.figure(figsize=[10, 10])
plt.title(&...
-4
votes
0
answers
34
views
Is it possible to embed matplotlib.figure.Figure object as subplot of another figure? [closed]
I am conducting an analysis of the impulse response of a system model using statmodels VAR.irf.
Method VARResults.irf.plot returns a matplotlib.figure.Figure type object.
I want to put several such ...
-1
votes
0
answers
71
views
How do I only have my data such that it only shows circles instead of ellipses? Why are the ellipses appearing? [closed]
In my plot, I am getting plot markers that are both circles and ellipses. I have generated previous plots using analogous code and get circles only, as desired. I tried ax.axis("equal") and ...
1
vote
1
answer
109
views
Jupyter Lite outputs a blank file when I use plt.savefig()
I'm writing a Python code that's supposed to create a graph and export it as a vector PDF file. I'm using Jupyter Lite at jupyter.org.
I've successfully created the graph, but when I try to export it ...
1
vote
2
answers
81
views
Why does Matplotlib DatetimeIndex plot misalign dates?
Why does matplotlib round to the nearest month sometimes and not other times depending on the order lines are plotted and which dates are used. ax3 and ax4 are particularly interesting because they ...
1
vote
1
answer
51
views
Colorbar tick locations not correct
I'm making a protein secondary structure plot, at first with trivial data:
import matplotlib.pyplot as plt
fig, ax0 = plt.subplots(1,1, layout = "constrained")
from matplotlib.colors import ...
0
votes
1
answer
73
views
Show the value at hovered position (x,y) with interactive pcolormesh plots
I find the coordinates shown below (in the form: (x, y) [z]) very useful for interacting with the data. Unfortunately, librosa.display.specshow does not show the value at (x, y), rather, only the ...
2
votes
1
answer
93
views
Why is list[list[str]] not equal to list[HashableList[Hashable]]
I struggle with typechecks using matplotlib.pyplot.subplot_mosaic.
I have create the following fuction, which generates the mosaic pattern and the per_subplot_kw:
def create_mosaic(num_rows):
def ...
Advice
0
votes
2
replies
58
views
How do I set the matplotlib co-ordinate system to SVG
A synopsis of my code.
import matplotlib.pyplot as plt
import shapely.plotting
from shapely.geometry import Polygon
facing = 'north'
shape = 'triangle'
polygon = Polygon(((1, 17), (9, 1), (17,...
0
votes
1
answer
56
views
Crop extra white-space on matplotlib picture
I made a "gauge" image using the following code:
taux = 91
# Plot
fig, ax = plt.subplots(figsize=(7.5,5), subplot_kw=dict(polar=True))
ax.set_theta_zero_location("W") ...
1
vote
1
answer
86
views
How to expand equal-aspect data limits in one direction only?
I've been trying to set equal data aspect ratios in matplotlib with ax.set_aspect('equal', 'datalim') (aka ax.axis('equal')), while preserving lower bounds/limits, aka anchoring one side of the data ...