Questions tagged [matplotlib]

Matplotlib is a plotting library for Python which may be used interactively or embedded in stand-alone GUIs. Its compact "pyplot" interface is similar to the plotting functions of MATLAB®.

Filter by
Sorted by
Tagged with
0 votes
1 answer
15 views

Make x-axis, y-axis in classes

I use python to makd graph. I made x-axis, y-axis with arrow and remove not using axes. But it is long so I have problem to use this code again and again. import matplotlib.pyplot as plt fig = plt....
GREG's user avatar
  • 1
0 votes
0 answers
9 views

plt.histogram on categorial data and fixed categories

It's great the plt.hist does the right thing with categorical data! Very cool. But how do I specify the bins and their order, like I can do with numerical data? I want to show a bunch of histograms, ...
Malcolm Slaney's user avatar
-1 votes
0 answers
45 views

Cant get my Logistic regression algorithm to display any of the plots [closed]

This is my code for a logistic regression project. I have no errors in and the program runs but once it is done running it only displays process finished exit code 0. It is supposed to show things ...
deadpanrobo's user avatar
0 votes
0 answers
17 views

How to plot yearly (bar) and monthly (line) time series on same graph with pandas matplotlib

I have two dataframes, one called "Income" and one called "Price". Sample data is shown below.Income is annual data, whereas Price is monthly data. I would like to plot both series ...
Daniel Santos's user avatar
0 votes
0 answers
14 views

How to create matplotlib plot for dates?

I have a list of dates. Each one has this format - datetime.datetime(2023, 12, 3, 22, 19, 54, tzinfo=datetime.timezone.utc) I want to create a plot. Each date means some action happened at this ...
octaneal's user avatar
-1 votes
0 answers
31 views

Li Mu Hands-On Learning Deep Learning in d2l Packets Not Images [closed]

I don't know why, but the code I'm using isn't producing any images.After checking the information found to be installed too many python version will lead to this situation, in the code at the end of ...
zhenyu xu's user avatar
0 votes
0 answers
10 views

superimposing axes on subplots in matplotlib

I have a nxn matplotlib subplot. Each subplot contains some timeseries plots. Each row of subplots corresponds to particular bin of variable 'second PC' and column corresponds to a particular bin of ...
jaweria's user avatar
  • 63
0 votes
0 answers
32 views

pyplot is bleeding into background using 3d array

I'm trying to generate maps of wind data using a 3d array described as: <xarray.Dataset> Dimensions: (gust_cat: 3, rose_group: 80, latitude: 1377, longitude: 2145) Coordinates: * gust_cat ...
deadpickle's user avatar
0 votes
1 answer
41 views

Legend in matplotlib jumps around with minimal change to bbox_to_anchor parameters

I have this issue in matplotlib that drives me crazy. I want to position the legend within the plot to be in a certain position, for example, in this case, in the top left corner (matching the corner ...
My Work's user avatar
  • 2,273
0 votes
1 answer
20 views

Create a barh graph with mapped colors inside using matplotlib

I'm tring to create a graph that has different bars with different colors inside: 5 green red green red red 4 green green green red red 3 green red green green red 2 green red green red green 1 green ...
Giuseppe Debby's user avatar
0 votes
1 answer
32 views

Color around the figure in python plot (matplotlib)

I have a matlab 3d barplot and within the grid, I understand that there is a background color. However, that color seems to extend outside the grid aswell forming a gray-ish square. I would like to ...
Mart's user avatar
  • 497
1 vote
0 answers
53 views

Set range for edge width in networkx

I would like to create a network plot similar to here and set the width of the edges via import matplotlib.pyplot as plt import networkx as nx import random val=10 G = nx.star_graph(val) pos = nx....
User314's user avatar
  • 11
0 votes
0 answers
31 views

show() from matplotlib.pyplot is not working, how can I fix it?

I am trying to make a plot of an equation for a homework problem. I didn't write the code, just copied and pasted it. Shown below is the code. Does anyone know why the plot is not showing/how to fix ...
David Eckland II's user avatar
-1 votes
0 answers
28 views

Plot multiple columns from a Pandas DataFrame with gaps between dates

I've concatenated a large csv dataset which is ingested by pandas. There are some missing datapoints which I'm stripping, leaving gaps in the date. If plotted the column with the missing date seems to ...
Drago100ful's user avatar
-3 votes
0 answers
23 views

split a 3D into 3 numpy arrays then convert to 2D

I'm trying to produce maps of 3 different axes of a 3D numpy array. The array takes the shape (1597,2345,3), with the 3rd axis being what I want to make individual maps from. In that sense I need ...
deadpickle's user avatar
0 votes
0 answers
23 views

How to get the Medial Axis from 2D Points

I am looking for a method to get the Medial Axis from a height of a blade's scatter points. The points look like this enter image description here I have studied some correlated algorithms and tried ...
Wenll shapion's user avatar
-1 votes
0 answers
27 views

Matplotlib - Repeat radial labels around the circle

I'm trying to create a graph with Matplotlib and I'd like to repeat the "radial labels" between circles several times so that I don't have to go round and round to find the value I'm looking ...
David's user avatar
  • 1
1 vote
1 answer
39 views

Why can I plot data arrays containing None values when using numpy array, but not when using list?

I have some data, X and Y, which I'd like to plot simply as X vs Y. However, for some elements of Y, there is no data. I record this as None rather than 0, since matplotlib helpfully does not plot it (...
shadowbiscuit's user avatar
1 vote
1 answer
51 views

Surface plot with wireframe

I want to have a plot_surface with "helplines" on the surface. My code so far: import numpy as np import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111, projection=&...
Eduard Tetzlaff's user avatar
0 votes
0 answers
59 views

Create waterfall chart

I have a problem. I want to create a waterfall chart. But Unfortunately it does not look correctly what I want. For example the numbers are not correctly placed and the text is missing at the end. And ...
Test's user avatar
  • 609
0 votes
0 answers
29 views

Is there a way to change the order of the feature in summary_plot of shap?

I want to decide the order of the feature inside the shap.summary_plot Here is a code that is working, I want to learn to change the order of the variable instead of having ordered in list of ...
Pitone's user avatar
  • 43
0 votes
0 answers
30 views

Define a variable getting the value from a matplotlib scatter coordinate

I am trying to use a x coordinate of a point, as x coordinate of the first point for a line. I change this value every day, and I would like it to change automatically for the line. Any suggestions? #...
vecchiemaniere's user avatar
1 vote
2 answers
71 views

Finite difference method converging to wrong steady state (python)

I'm trying to recreate numerical results from an article. In particular, I want to numerically solve the following PDE system: In this system, Fn represents a prey population density, Cn a predator ...
Ama's user avatar
  • 25
0 votes
0 answers
33 views

Python MatPlotLib Boxplot Colors [duplicate]

I'm trying to make a boxplot using the matplotlib package in Python. distinctsets.boxplot(column = 'list_price', by = 'review_difficulty', patch_artist = True, vert = False, showfliers = False, ...
Daniel's user avatar
  • 1
0 votes
0 answers
35 views

Issues plotting land cover map correctly in Python

I am having some issues correctly plotting some manually digitized land cover rasters into Python correctly. When I plot the rasters the first 6 land cover classes are plotting normally with no issues,...
greg684's user avatar
0 votes
0 answers
15 views

streamlit website don't show plot and metric

I coded a Streamlit website with plot and metric but it doesn't work. import streamlit as st import matplotlib.pyplot as plt import numpy as np import pandas as pd st.title("website") st....
Joo's user avatar
  • 15
1 vote
1 answer
39 views

How can i plot a graph that has a value for each month displaying in the x label tick just the year? In Matplotlib.Pyplot

cur.execute( """ SELECT sum(value), Extract ('month' from dateOperation), Extract ('year' from dateOperation) FROM movimenti GROUP BY (Extract ('month' from dateOperation)), (Extract ('...
RandomGuy's user avatar
0 votes
0 answers
20 views

Can matplotlib change time range dynamicly in stock K line?

I want to plot a stock K line with matplotlib. I want to change the time range selection dynamicly in my plot like in the attached picture. How can I achieve this?
fanronghong's user avatar
0 votes
0 answers
46 views

Failed to convert value(s) to axis units datetime

I am trying to plot a line using, as coordinates, also a datetime variable. But still having the same error. Any help? I have tried to use a variable as plot coordinate (x axis). The variable is the ...
vecchiemaniere's user avatar
-1 votes
1 answer
23 views

Loop n-times, adding a new y-data series (different scale) to the same x-axis plot (using ax.twinx())

I'm trying to follow these examples, Using loops to create multiple matplotlib graphs with dual y-axes How do you plot two different y-axes using a loop with twinx? How to use "ax.twinx()" ...
Ben Nguyen's user avatar
0 votes
0 answers
18 views

set axis limits when using groupby [duplicate]

I have a dataframe with groups of data that need to be plotted. They are a sequence of topographic profiles where the data for the first one has the value of 1 in the LINE_ID field, and so on. I ...
Kevin Urbanczyk's user avatar
0 votes
0 answers
28 views

Matplotlib raise ValueError: cannot convert float NaN to integer in tkinter app

I have a tkinter app and i want to open video and then show chart in another window.(using cv2) If i first click on show chart button, it works fine.But when I open the file, the chart is no longer ...
Ali Rahmani's user avatar
2 votes
2 answers
74 views

Issue with triangles borders in Matplotlib

I am facing an issue with drawing triangle borders using Matplotlib in Python. I want to create a specific pattern, but I'm encountering unexpected behavior. I need assistance in identifying and ...
Umar's user avatar
  • 391
0 votes
0 answers
36 views

Plot an eye diagram with a cmap 'hot'

I'd like to plot an eye diagram with a 'hot' colormap that becomes clearer not when the signal has high values, but when the signal is dense at an instant in time, see picture below. Here is what I'...
Dylan Chevalier's user avatar
0 votes
0 answers
15 views

how can I install matplotlib in Jupyter Notebook?

I have alredy installed matplotlib on my venv in Pycharm. I tried to run it in Jupyter Notebook and them I got noticement No module named 'matplotlib' I also tried to run !pip install matplotlib at ...
bepebdepd's user avatar
0 votes
0 answers
20 views

Plotting with matplotlib in tkinter Interface

Currently, I have a TKinter window that opens with a Pandastable table of data and five buttons at the bottom. Four of the buttons are intended to be used such that a user can click on a row in the ...
Oshua's user avatar
  • 23
0 votes
0 answers
45 views

How to create a symmetrical colorbar using pcolormesh() in matplotlib?

I've been trying to solve this problem for a while, but I'm still struggling, as the Flopy documentation doesn't cover this issue, and I don't have an in depth understanding of pcolormesh() and ...
Viridis's user avatar
-1 votes
1 answer
24 views

Seaborn legend generated with hue breaks on melted dataframe [duplicate]

Problem I have following problem (which occured when I was trying to work on some melted df's). The problem is that when I am trying to manually set labels to melted df there appears to be one ...
piotre10's user avatar
1 vote
1 answer
44 views

Quantization of an RGB image

I'm doing for a university project a "cartoon-like" filter for an RGB image, so I'm trying to do something to quantize the image. The only libraries I can use are numpy, matplotlib.pyplot ...
perezz's user avatar
  • 19
0 votes
0 answers
18 views

Searching for pyplot.streamplot integration step or smoothing factor [closed]

I would like to know what the integration step, which apparently depends on the density parameter choice, of the pyplot.streamplot function. Indeed, my vector field is very noisy, and yet, the ...
Hélène Penvern's user avatar
0 votes
1 answer
33 views

How can I add spines to the left of a figure in matplotlib?

I'm trying to plot the DATE on the X-Axis, and then Temperature, Humidity, Pressure, and UV-Index on 4 Y-axes (same figure-no subplots) I'd like for the spine and legend for the Temperature to be on ...
Ben Nguyen's user avatar
0 votes
0 answers
14 views

Widget to visually select time ranges on a graph?

I'm graphing spectral data and I want to be able to graph my data, and using a slider, select portions of the graph and display the times I have selected. Just like highlighting a word in a paragraph, ...
abkeaton's user avatar
0 votes
0 answers
54 views

adjustText incorrectly positions annotations when x and y values greater than 1

We're using matplotlib and adjustText to plot XY coordinates and pass a list of labels to specific points in the plot and prevent the labels from overlapping one another. However, I noticed that ...
rikitikitik's user avatar
  • 2,444
0 votes
0 answers
50 views
+50

Parabolic connection graph using Matplotlib

I am trying to create a connection graph using Python. I'd like a series of points across the UK converging on a target, with accentuated parabolic arcs. I have a code attempt that is plotting ...
Samuel's user avatar
  • 117
0 votes
0 answers
21 views

Matplotlib: ValueError: The number of FixedLocator locations (27), usually from a call to set_ticks, does not match the number of ticklabels (24)

I have the following code import matplotlib.pyplot as plt import numpy as np heating_activity = [0, 1, 1, 0, 0.06, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
PeterBe's user avatar
  • 732
0 votes
0 answers
18 views

LSTM Plot Scale is Off by Orders of Magnitude

I’ve been wrangling with an LSTM for stock prediction for the past week. I am at the point where I need to plot the predicted stock price against the actual stock price. However, the plot I generate ...
CK1's user avatar
  • 13
0 votes
0 answers
28 views

Python plots display inline successfully but not using qt

Using a python package called quantstats, I'm able to plot successfully to the inline Plots pane in Spyder, but when changing matplotlib backend to qt, nothing is displayed. Working in Ubuntu 22.04, ...
Chris's user avatar
  • 1,400
0 votes
1 answer
47 views

How to animate the particles at each timestep instead of their orbits in my simulation?

I want to animate my simulation in a better way: a) Current code is simulating their orbits as a function of time. It is really some zigzag lines at the moment which is "ugly" to look at. b) ...
bluebee09r's user avatar
0 votes
1 answer
38 views

How to pass a list of 2d arguments to Python?

The use case is I have a list of x,y coordinates that I display in a matplotlib graph. I hard coded the values as below to get it to work. The code I was using is: import matplotlib.pyplot as plt ...
James-Jesse Drinkard's user avatar
0 votes
1 answer
62 views

I need help fixing the error "value is trying to be set on a copy of a slice from a DataFrame"

I'm relatively new to python and all its libraries, and I am a bit confused on what to do with the piece of code I've written in order to get rid of the error "SettingWithCopyWarning: A value is ...
Penguinite's user avatar

1
2 3 4 5
1431