[PYTHON] Paste a link to the data point of the graph created by jupyterlab & matplotlib

About this article

I wanted to do what the article title says. Make a note of how you do it, as you may use it again.

procedure

--Create linked graphs with matplotlib --Save in svg format --Open the file in a browser such as Chrome

environment

I was working on jupyter-lab. The version looks like this (from the result of pip freeze)

jupyterlab-server==1.0.7
matplotlib==3.2.1

File creation

#various settings
import matplotlib.pyplot as plt
from IPython.display import set_matplotlib_formats

set_matplotlib_formats("svg")

#Test data preparation
data_list = [[0, 1], [1,0], [1,1]]
label_list = ['google', 'yahoo', 'lightcafe']
url_list = ['https://www.google.com/', 'https://www.yahoo.co.jp/', 'https://www.lightcafe.co.jp/']

#Graph creation
fig, ax = plt.subplots(1, 1, tight_layout=True)
for d, l, u in zip(data_list, label_list, url_list):
    x, y = d
    ax.scatter(x, y)  #Point plot
    ax.annotate(l, xy=(x, y), size=10,  #Character plot
                url=u,
                bbox=dict(color='w', alpha=1e-6, url=u),
               )
#Save
fig.savefig('test.svg')

Verification

Open test.svg in your browser and click on the data points or labels in the graph Jump to the set link.

By the way, if you run the same thing in Google Colaboratory, you don't have to save svg I was able to fly from the output of the cell.

IMG_20200408_091005.jpg

that's all

reference

Recommended Posts

Paste a link to the data point of the graph created by jupyterlab & matplotlib
How to avoid the cut-off label of the graph created by the plot module using matplotlib
How to plot a lot of legends by changing the color of the graph continuously with matplotlib
Omit the decimal point of the graph scale in matplotlib
Try to create a battle record table with matplotlib from the data of "Schedule-kun"
A network diagram was created with the data of COVID-19.
I want to change the color by clicking the scatter point in matplotlib
How to draw a graph using Matplotlib
How to send a visualization image of data created in Python to Typetalk
I tried to display the altitude value of DTM in a graph
I tried to verify the result of A / B test by chi-square test
Let's use Python to represent the frequency of binary data contained in a data frame in a single bar graph.
I made a tool to easily display data as a graph by GUI operation.
Use libsixel to output Sixel in Python and output a Matplotlib graph to the terminal.
[python] How to sort by the Nth Mth element of a multidimensional array
Change the data frame of pandas purchase data (id x product) to a dictionary
I tried to rescue the data of the laptop by booting it on Ubuntu
[Introduction to Python] How to get the index of data with a for statement
How to calculate the volatility of a brand
Increase the font size of the graph with matplotlib
Change the decimal point of logging from, to.
The basis of graph theory with matplotlib animation
Use a cool graph to analyze PES data!
An easy way to measure the processing speed of a disk recognized by Linux
[Ruby] How to replace only a part of the string matched by the regular expression?
Add a function to tell the weather of today to slack bot (made by python)
[Python] How to draw a line graph with Matplotlib
A memo to visually understand the axis of pandas.Panel
Add information to the bottom of the figure with Matplotlib
Save the graph drawn by pyqtgraph to an image
Link the mouse to the gyro of the Nintendo Switch Procon
[Introduction to Python] Basic usage of the library matplotlib
Python Note: The mystery of assigning a variable to a variable
I drew a Python graph using public data on the number of patients positive for the new coronavirus (COVID-19) in Tokyo + with a link to the national version of practice data
IDWR bulletin data scraping the number of reports per fixed point of influenza and by prefecture
I want to output a beautifully customized heat map of the correlation matrix. matplotlib edition
How to plot the distribution of bacterial composition from Qiime2 analysis data in a box plot
Create a 2D array by adding a row to the end of an empty array with numpy
[Graph drawing] I tried to write a bar graph of multiple series with matplotlib and seaborn
When generating a large number of graphs with matplotlib, I do not want to display the graph on the screen (jupyter environment)
Instantly create a diagram of 2D data using python's matplotlib
[Ubuntu] How to delete the entire contents of a directory
[Python] How to make a list of character strings character by character
How to test the attributes added by add_request_method of pyramid
[pyqtgraph] Add region to the graph and link it with the graph region
[Introduction to matplotlib] Read the end time from COVID-19 data ♬
Build a Python environment and transfer data to the server
Debug by attaching to the Python process of the SSH destination
The story of copying data from S3 to Google's TeamDrive
How to find the scaling factor of a biorthogonal wavelet
Convert the image data (png) at hand to a .pbm image
Find the diameter of the graph by breadth-first search (Python memory)
Created a method to downsample for unbalanced data (for binary classification)
What I saw by analyzing the data of the engineer market
Is there a secret to the frequency of pi numbers?
How to connect the contents of a list into a string
I sent the data of Raspberry Pi to GCP (free)
Try to extract the features of the sensor data with CNN
How to get the pixel value of the point from the satellite image by specifying the latitude and longitude
I will publish a shell script created to reduce the trouble of creating LiveUSB on Linux
Fixed-point observation of specific data on the Web by automatically executing a Web browser on the server (Ubuntu16.04) (2) -Web scraping-