Difference between revisions of "Fancy Plots using Plotly"

(Syntax highlight test)
m (Syntax highlight test)
Line 1: Line 1:
 
{{Nutshell|elegant plots for adding in to research papers.|title=}}
 
{{Nutshell|elegant plots for adding in to research papers.|title=}}
  
* This is a collection of simple plots using the plotly library.
+
*This is a collection of simple plots using the plotly library.
* It consists of elegant color schemes and easy to ready adjustable fonts.
+
*It consists of elegant color schemes and easy to ready adjustable fonts.
* The reason for using plotly is that it allows for HTML plots that can be scaled and zoomed after plotting.
+
*The reason for using plotly is that it allows for HTML plots that can be scaled and zoomed after plotting.
  
== Installation ==
+
==Installation==
 
We need the [https://pypi.org/project/plotly-express/ plotly-express] library.
 
We need the [https://pypi.org/project/plotly-express/ plotly-express] library.
  
==== Conda ====
+
====Conda====
 
<syntaxhighlight lang="shell">
 
<syntaxhighlight lang="shell">
 
conda install -c plotly plotly_express==0.4.0
 
conda install -c plotly plotly_express==0.4.0
Line 14: Line 14:
 
  conda install -c plotly plotly_express==0.4.0
 
  conda install -c plotly plotly_express==0.4.0
  
==== Pip ====
+
====Pip====
 
  pip install plotly_express==0.4.0
 
  pip install plotly_express==0.4.0
  
== Line Plots ==
+
==Line Plots==
 
<syntaxhighlight lang="python3">
 
<syntaxhighlight lang="python3">
 
# x and y given as array_like objects
 
# x and y given as array_like objects
Line 25: Line 25:
 
</syntaxhighlight><br />
 
</syntaxhighlight><br />
  
== Scatter Plots ==
+
==Scatter Plots==

Revision as of 06:40, 18 February 2022


  • This is a collection of simple plots using the plotly library.
  • It consists of elegant color schemes and easy to ready adjustable fonts.
  • The reason for using plotly is that it allows for HTML plots that can be scaled and zoomed after plotting.

Installation

We need the plotly-express library.

Conda

conda install -c plotly plotly_express==0.4.0


conda install -c plotly plotly_express==0.4.0

Pip

pip install plotly_express==0.4.0

Line Plots

# x and y given as array_like objects
import plotly.express as px
fig = px.scatter(x=[0, 1, 2, 3, 4], y=[0, 1, 4, 9, 16])
fig.show()


Scatter Plots