[PYTHON] Display markers above the border with matplotlib

demo

Before After
clip_on_0.png clip_on_1.png

Method

Added clip_on = False to plot.

demo.py


import numpy as np
import matplotlib.pyplot as plt

x = np.arange(4)
y = np.cos(x)

plt.plot(x, y, "o-", clip_on=False)
plt.xlim(0, 3)
plt.ylim(-1, 1)

Caution

With clip_on = False, if you make a mistake in specifying the range, this will happen. In other words, clip_on = False is in a state where it is OK to stick out.

Unknown.png

import numpy as np
import matplotlib.pyplot as plt

x = np.arange(10)
y = np.cos(x)

plt.plot(x, y, "o-", clip_on=False)
plt.xlim(0, 3)
plt.ylim(-1, 1)

reference

python - How do I let my matplotlib plot go beyond the axes? - Stack Overflow http://stackoverflow.com/questions/9912206/how-do-i-let-my-matplotlib-plot-go-beyond-the-axes

Recommended Posts

Display markers above the border with matplotlib
Display the graph while changing the parameters with PySimpleGUI + Matplotlib
[Python] Read the csv file and display the figure with matplotlib
Inference & result display with Tensorflow + matplotlib
[Python] Set the graph range with matplotlib
Adjust the spacing between figures with Matplotlib
Align the size of the colorbar with matplotlib
Image display taken with the built-in ISIGHT
Display Python 3 in the browser with MAMP
Display Japanese graphs with VS Code + matplotlib
Set the xticklabels color individually with matplotlib
Match the colorbar to the figure with matplotlib
[Jupyter Notebook memo] Display kanji with matplotlib
Mouse over Matplotlib to display the corresponding image
Display the edge
How to turn off the scale value display while leaving the grid with matplotlib
Drawing tips with matplotlib on the server side
Find a position above the threshold with NumPy
Increase the font size of the graph with matplotlib
Animation with matplotlib
Japanese with matplotlib
How to display images continuously with matplotlib Note
Animation with matplotlib
Visualize the behavior of the sorting algorithm with matplotlib
Histogram with matplotlib
Animate with matplotlib
matplotlib: Replace the axis itself with another one.
Display the image after Data Augmentation with Pytorch
Add information to the bottom of the figure with Matplotlib
Display the integrated temperature for each field with Z-GIS
Display / update the graph according to the input with PySimpleGui
Adjust the ratio of multiple figures with the matplotlib gridspec
2-axis plot with Matplotlib
Heatmap with Python + matplotlib
Band graph with matplotlib
Learn with Cheminformatics Matplotlib
Real-time drawing with matplotlib
3D display with plotly
Various colorbars with Matplotlib
3D plot with matplotlib
Enlarge the plot display.
Taskbar display with tqdm
Adjust axes with matplotlib
Display only the lower half (upper half) with seaborn pair plot
Display only the resources created when acquiring AWS resources with Boto3
Reformat the timeline of the pandas time series plot with matplotlib
Display vector tiles nicely with the official MapTiler QGIS plugin
Let's visualize the number of people infected with coronavirus with matplotlib
Read the VTK file and display the color map with jupyter.
Estimate the attitude of AR markers with Python + OpenCV + drone
I wrote the basic operation of matplotlib with Jupyter Lab