72,810 questions
0
votes
0
answers
43
views
Matplotlib figsize has no visible effect in Spyder plots pane
I am using Matplotlib in Spyder and I am trying to change the figure size with figsize, but it does not seem to make any visible difference no matter what values I use.
For example, even if I change:
...
3
votes
2
answers
75
views
How to visualize a dense, gappy time series with spikes in Python?
I have a sensor time series with these properties:
~250,000 data points at high sampling rate over ~12 hours
~11 continuous segments separated by 30-40 minute gaps (sensor goes offline periodically)
...
0
votes
1
answer
76
views
How can I make this plot using Seaborn or matplotlib?
How can I make this plot using Seaborn or matplotlib? A key requirement is that the plot code be less than about 10 lines (this code is meant to go in a book and should not require a PhD in matplotlib)...
1
vote
2
answers
73
views
Missing minus signs in symlog scale
I have the following plot, using a symmetric log scale:
from matplotlib import pyplot as plt
from matplotlib import ticker
(_, ax) = plt.subplots()
ax.plot([-100, -1, -0.5, 0, 0.5, 1, 100], marker='o')...
Advice
0
votes
3
replies
52
views
How to make a 3D plot from a 3D numpy array
I would like to make a 3D surface plot (ideally like the one seen here https://matplotlib.org/stable/gallery/mplot3d/contour3d_3.html) from a 3D array.
How do I take one 3D array and create the three ...
1
vote
0
answers
76
views
python trying to plot a DFA with networkx and matplotlib
Hi I was trying to implement a plot function for a DFA class, using networkx in python.
def plot(self):
G = nx.MultiDiGraph()
nodes = self.collect_nodes()
for n in nodes:
...
3
votes
1
answer
117
views
Pandas IndexError: DataFrame indexer is not allowed for .iloc
I'm trying to plot actual vs predicted values using matplotlib.
Here is my code:
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn....
2
votes
2
answers
139
views
Pandas aggregate() creates weird DataFrame
I've been scratching my head over this way too long now, but can't find any answers online, and I hope someone can shed some light on this.
I'm working with Pandas and a csv file, from which I need to ...
Advice
1
vote
1
replies
62
views
How can I insert a custom symbol between y‑axis tick labels in Matplotlib?
I have a plot with categorical labels on the y‑axis, similar to this:
I would like to display a symbol (e.g., +) between every pair of y‑axis tick labels, such as between eight and eight u two.
Is it ...
Tooling
0
votes
2
replies
31
views
cmap gradient in legend patch
I am running matplotlib in Python.
I have a histogram showing data from 36 different channels, each colored by a cmap gradient. I want to be able to put a gradient in my legend, possibly through a ...
6
votes
2
answers
125
views
Fixing plotting artifacts when using plt.xscale('symlog')
How to fix these kinks in the norm_pan and norm_tau curves? I tried using a quite high resolution and logarithmic spacing when defining t, but this did not fix the problem.
import numpy as np
import ...
Tooling
0
votes
2
replies
64
views
Is there a way to fill areas of a plot based on a condition?
I'd like to do something like pyplot.fill_between but I want to shade areas where a plot goes above a threshold (0.5) in the x-axis.
For example, here's a plot I produced using pyplot.fill_between and ...
Advice
0
votes
2
replies
79
views
I'm struggling with changing the way Matplotlib labels the steps on the x axis
I have a while loop that is running 5000 times a second. Each time it runs it recalculates a whole ton of variables and then adds the value of a couple of those varibles to their own lists. After a ...
Advice
0
votes
5
replies
99
views
End Simulation on surface collision
I'm making an orbit decay simulation and I don't know how can I make the simulation stop/break when the object collides with the surface. It keeps simulating inside the planet's surface and doesn't ...
-3
votes
2
answers
93
views
How to create a 2D graph from data in a file using matplotlib in Python?
I am working on a Python project and I need to generate a 2D graph using matplotlib.
The data is stored in a text file with two columns (x and y values).
Example file:
1 10
2 20
3 30
4 40
How can I ...