Skip to main content

All Questions

Tagged with
0 votes
0 answers
125 views

Plotting real-time graphs using Matplotlib does not allow plotting second graph

I am reading data from serial port and based on that, plotting graphs using matplotlib. The data from serial port is in format: ecg 9.89 4.5 123 . . end psd 2.1, 33.2 3.4, 92.10 . . end fft 2.1, 33.2 ...
A Shrestha's user avatar
0 votes
1 answer
37 views

python - matplotlib closes window immediately

I have created a sin wave in matplotlib and when I run the code the the window opens and closes immediately without showing anything. What can I do to display the results. import torch, time import ...
Sharks  Charlatans's user avatar
1 vote
1 answer
34 views

Change number of ticks labeled using LogFormatter in Matplotlib

In Matplotlib's documentation for matplotlib.ticker.LogFormatter it is stated that with the parameter minor_thresholds one can control the labeling of minor ticks: If labelOnlyBase is False, these ...
Adrián T.'s user avatar
3 votes
2 answers
58 views

Subplot four-pack under another subplot the size of the four-pack [duplicate]

I want to make a matplotlib figure that has two components: A 2x2 "four pack" of subplots in the lower half of the figure A subplot above the four pack that is the size of the four pack. I ...
Dave's user avatar
  • 490
0 votes
2 answers
317 views

Building gauge chart in Python with matplotlib [duplicate]

I am attempting to follow this tutorial to create a roughly semi-circle gauge chart with matplotlib. However, my figure contains several different charts - it is being created via a line like: fig, ax ...
Charlie Horn's user avatar
1 vote
1 answer
45 views

How to draw the horizontal and vertical lines for every value of x and y ticks with a specific opacity? (in the background) [duplicate]

x = [value for value in df['YEAR']] y1 = [value for value in df['ANNUAL']] y2 = [df['ANNUAL'].mean()]*(len(x)) fig = plt.figure(figsize=(8,5)) plt.plot(x,y1,label='Annual rainfall',color='blue') plt....
Chakradhar Kalla's user avatar
5 votes
3 answers
246 views

How can I save a figure to PDF with a specific page size and padding?

I have generated a matplotlib figure that I want to save to a PDF. So far, this is straightforward. import matplotlib.pyplot as plt x = [1, 2, 3, 4] y = [3, 5, 4, 7] plt.scatter(x, y) plt.savefig( ...
Dave's user avatar
  • 490
-1 votes
1 answer
39 views

What to do with `matplotlib` graphs given in a list that a function returns (or what is an alternative function architecture)?

I have a function that works something like this. import numpy as np import matplotlib.pyplot as plt def plot_from_dave(n = 100, r = 10): my_list = [] for i in range(r): ...
Dave's user avatar
  • 490
1 vote
0 answers
81 views

Rotating matplotlib subplot with additional axes

I am currently struggling to create a 3-panel figure where the centre plot contains a contour plot and the top left and right panels show some lines. The thing is that all the plots are rotated 45 ...
Sven Lämmle's user avatar
0 votes
1 answer
63 views

Visualization of Graphs Data [closed]

I need to visualize graphs where each pair of nodes connected by a comma represents an edge, and the numeric value represents the intensity of that edge. For instance, ('A', 'B'): 0.71 means that node ...
Ahmad's user avatar
  • 762
2 votes
1 answer
40 views

Unable to set the y position / interval of lines in plot

The following produces a lot of rows of lines. I want the vertical gaps between the rows of lines to be much smaller though i.e. all the rows moved down apart from the lowest. I can't for the life of ...
Beardsley's user avatar
  • 171
0 votes
2 answers
69 views

SymPy - plot differential equation graph

I get error when trying to plot a graph : TypeError: Cannot convert expression to float I also get empty graph: from sympy import * from IPython.display import display init_printing() import ...
tomopa73's user avatar
-2 votes
1 answer
148 views

Sklearn module missing and unsure what to use instead?

I'm currently following this guide https://www.geeksforgeeks.org/rainfall-prediction-using-machine-learning-python/ However. I am getting this error for the following lines of code. for i in range(3): ...
John.R's user avatar
  • 3
0 votes
1 answer
69 views

Unable to get pie chart to correctly format with matplotlib

my code is this: plt.pie(df['Rainfall'].value_counts().values, labels = df['Rainfall'].value_counts().index, autopct='%1.1f%%') plt.show() df.groupby('Rainfall').mean() ...
John.R's user avatar
  • 3
0 votes
1 answer
42 views

Setting x-axis data in data visualization using matplotlib is not working properly

I'm using a CSV file and want to put the date data as it appears in the table directly on the x-axis of the graph, but the x-axis data in my graph is displayed incorrectly. Which part of my code could ...
littleBoyyy's user avatar

15 30 50 per page
1
2 3 4 5
88