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®.
matplotlib
72,443
questions
0
votes
0
answers
9
views
Setting title in displot for each subplot
I want to set the title of each graph to be the crop type and the interval it is looking at.
# Load the CSV files
df_corn = pd.read_csv(r"D:\Final Prep\Everything\WUVR_corn.csv")
df_soy = ...
0
votes
0
answers
19
views
Change color for displot based on column
I have a displot Displot for corn and soy. I want the data for Corn to be a different color (say Red and Green) and the data for soy to be (Orange and Blue)
df_melted = {'Sink_ID': ['...
0
votes
0
answers
17
views
Multiple partial dependence plot with regression line in a grid
Basically, what I need is this but with the regression line:
The partial dependence plots that SHAP outputs, each one of them with a regression line, and plotted into a grid.
I know how to get ...
-1
votes
0
answers
19
views
matplotlib shrinking pygame window
Whenever I run the program, the pygame window shrinks as the matplotlib window and the text inside is being rendered. I think im missing some information or im just being silly, help.
import pygame
...
1
vote
1
answer
27
views
How to delete margin between figure and subplot in matplotlib
fig, ax = plt.subplots(figsize=(10, 6))
fig.patch.set_facecolor('#87ceeb')
ax.set_axis_off()
ax.set_xlim(minx, maxx)
ax.set_ylim(miny, maxy)
gdf.plot(ax=ax, facecolor='#dcdcdd', edgecolor='#a5abae')
...
1
vote
1
answer
21
views
Cartopy does not format longitude/latitude axis
I try to plot a map with cartopy, and label latitudes with some digits.
See the following code.
The last two lines are not effective, and cartopy still displays latitudes as '7.5°S 7°S ...', when it ...
0
votes
1
answer
26
views
create discrete colorbar from colormap in python
I want to use a given colormap (let's say viridis) and create plots and colorbars with discrete colors from that colormap.
I used to use mpl.cm.get_cmap("viridis", 7) for 7 different colors, ...
-1
votes
0
answers
21
views
A problem with Importing Matplotlib (A module that was compiled using NumPy 1.x) [duplicate]
When I'm trying to import matplotlib by the following standard code:
import matplotlib.pyplot as plt
I'm getting the following error massage:
A module that was compiled using NumPy 1.x cannot be run ...
0
votes
1
answer
23
views
Set grid frequency for plot
I have a very simple code that plots points by coordinates (x, y)
def separate_file(coordinates):
new_document_x, new_document_y = zip(*coordinates)
plt.gca().invert_yaxis()
plt.plot(...
0
votes
0
answers
25
views
How can you use axvspan to show missing datetime data?
I am plotting data showing the water surface elevation of a creek over a 16-year time span. The data are provided in 15-minute increments, but there are missing time periods, including one that lasted ...
1
vote
0
answers
26
views
Display custom dates on x axis matplotlib
Here is my plot:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib.dates as mdates
dates = pd.date_range('2020-03-31', '2024-06-30', freq='...
0
votes
1
answer
45
views
No lines between datapoints in pyplot
I'm trying to make a simple line plot with matplotlib.pyplot but i don't get lines between datapoints.
I have a pandas DataFrame with a DateTime index and I want a subplot for each weekday. Everything ...
1
vote
1
answer
45
views
Dynamic update of plot in Matplotlib generating strange lines
I'm trying use dynamically add rectangles to a plot using Matplotlib but some weird lines are showing up in the plot.
My grid is a class with init and an update function to add new rectangle shapes ...
-2
votes
0
answers
11
views
Different Result In t-SNE [closed]
can anyone help me answer my question ?
so i get dataset from paper and visualize with t-SNE. in other hand im trying to create new dataset with following the previous dataset feature. But after i ...
1
vote
1
answer
32
views
Python: Using Figure.set_size_inches on a Figure contained in a tkinter GUI does not update the display
I am trying to embed a pyplot Figure object in a tkinter GUI and then later on change its size by calling the set_size_inches() method.
A miniumum (not) working example is provided below. ...