The plotly library is an interactive open-source library. This can be a very helpful tool for data visualization and understanding the data simply and easily. Plotly graph objects are a high-level interface to plotly which are easy to use. It can plot various types of graphs and charts like scatter plots, line charts, bar charts, box plots, histograms, pie charts, etc.
Python is also capable of uploading created graph online for use in websites. In this article, a simple scatter plot is created to be used in websites and this graph is working on the particular website that is the beauty of plotly and chart-studio.
Installation:
pip install plotly pip install chart-studio
Approach:
Part A: Creating a graph
- Import module
- Create data
- Create plot
- Display graph
Part B: Taking the graph online
- Login/Signup in Chart Studio.
- After signing in find your username and API key in the settings section. (go to profile > settings > regenerate key)
- Now in your python script
- Again import module
- Pass API keys and username
- Pass all the necessary information to plot() function
- The output returned is a link, where the graph can be seen live.
Below is the implementation.
Python3
# importing required libraries import numpy as np import plotly import chart_studio import plotly.express as px # assigning values to x and y x = np.random.randint(low = 1 , high = 50 , size = 50 ) y = np.random.randint(low = 51 , high = 100 , size = 50 ) # creating and displaying graph fig = px.scatter(x = x, y = y) fig.show() |
Output:
Now as our graph is created. It’s time to use it online on websites.
Python3
import chart_studio username = # 'your username' api_key = # 'your api key' chart_studio.tools.set_credentials_file(username = username, api_key = api_key) py.plot(fig, filename = 'your filename' , auto_open = False , sharing = 'public' ) |
Output:
‘https://plotly.com/~username/graph number/’
[url=http://happyfamilymedicalstore.online/]canadian pharmacy 24h com[/url]
[url=https://olisinopril.online/]lisinopril 10 mg for sale[/url]
[url=https://azithromycinhq.com/]purchase azithromycin 500mg[/url]
[url=http://bmtadalafil.online/]tadalafil generic sale[/url]
[url=https://bestmedsx.com/]pharmacy wholesalers canada[/url]
[url=http://valtrexid.com/]purchase valtrex online[/url]
[url=http://azithromycinhq.com/]zithromax generic brand[/url]
[url=http://synthroidx.online/]synthroid mexico pharmacy[/url]
[url=https://valtrexmedication.com/]valtrex cost india[/url]
[url=http://metforemin.online/]metformin prescription[/url]
[url=http://lisinoprilgp.online/]buy prinivil[/url]
[url=https://azithromycinps.online/]zithromax 200 mg tablets[/url]
[url=http://pharmgf.online/]gold pharmacy online[/url]
[url=https://medicinesaf.online/]big pharmacy online[/url]
[url=https://oazithromycin.com/]where can i buy azithromycin 500mg[/url]
[url=http://asynthroid.com/]synthroid 137 mcg cost[/url]
[url=http://tadalafilstd.com/]tadalafil 20mg from india[/url]
[url=https://valtrexbt.online/]daily valtrex no prescription[/url]
[url=http://happyfamilystorerx.online/]online pharmacy store[/url]
[url=http://synthroidsl.online/]synthroid pharmacy[/url]
[url=https://oazithromycin.online/]azithromycin tablets canada[/url]
[url=https://bmtadalafil.online/]best online pharmacy tadalafil[/url]
[url=http://bestmedsx.com/]canadapharmacyonline com[/url]
[url=https://medicinesaf.online/]pharmacy home delivery[/url]
[url=http://medicinesaf.online/]online pharmacy ordering[/url]
[url=http://prednisoneo.online/]prednisone 2[/url]
[url=http://metforminbi.online/]metformin hcl 500mg[/url]
[url=http://valtrexarb.online/]how much is valtrex[/url]
[url=http://lisinoprildrl.online/]buy lisinopril 5mg[/url]
[url=https://tadalafilgf.com/]buy cheap tadalafil uk[/url]
[url=http://bestmedsx.online/]polish pharmacy online uk[/url]
[url=https://olisinopril.online/]lisinopril brand[/url]
[url=https://bmtadalafil.online/]tadalafil free shipping[/url]
[url=https://ametformin.com/]can i buy metformin over the counter[/url]
[url=https://tadalafilstd.com/]tadalafil canada online[/url]
[url=http://ezithromycin.online/]azithromycin 50 mg[/url]
[url=https://olisinopril.com/]best price for lisinopril[/url]
[url=http://synthroidx.online/]synthroid online prices[/url]