Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Python Plotly

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "how to use Python Plotly". In daily operation, I believe many people have doubts about how to use Python Plotly. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to use Python Plotly". Next, please follow the editor to study!

Detailed explanation of visual artifact Plotly_Express

Plotly is a new generation of data visualization artifact, TopQ extension open source team, although plotly is powerful, it has not been widely used, most py developers are still using the old matplotlib, the most important reason is that plotly setup is too cumbersome. Refractive index, plotly launched its simplified interface: Plotly Express, abbreviated as: px.

Plotly Express is an advanced package of Plotly.py, built-in practical, modern drawing template, users only need to call a simple API function, you can quickly generate beautiful interactive charts.

Plotly Express built-in chart combination, covering 90% of the common drawing needs, Python drawing, the first Plotly Express.

Encapsulation diagram description

Scatter: in a scatter chart, each line of data_frame is represented by a symbol in 2D space.

Scatter_3d: in a 3D scatter chart, each row of data_frame is represented by a symbol in 3D space.

Scatter_polar: in a polar scatter chart, each row of data_frame is represented by a symbol in polar coordinates.

Scatter_ternary: in a ternary scatter chart, each row of data_frame is represented by a symbol in ternary coordinates

Scatter_mapbox: in a Mapbox scatter chart, each line of data_frame is represented by a symbol on the Mapbox map.

Scatter_geo: in a geographic scatter map, each line of data_frame is represented by a symbolic mark on the map.

Scatter_matrix: in a scatter matrix (or SPLOM), each row of data_frame is represented by multiple symbol marks, and there is one in each cell of the grid of the 2D scatter chart, which sets the dimensions of each pair relative to each other.

Density_contour: density isoline map (bivariate distribution) in a density isoline map, rows data_frame are grouped together to form contour markers to visualize the 2D distribution z of the aggregate function histfunc (for example: count or sum) of the value.

Density_heatmap: density heat map (bivariate distribution) in a density heat map, rows of data_frame are grouped together into colored rectangular subdivisions to visualize the 2D distribution z of the aggregate function histfunc (for example: count or sum) of the value.

Line: in a 2D line diagram, each line data_frame is represented as the top of a dotted line mark in 2D space.

Line_polar: a polar line chart in which each line data_frame is represented as the top of a dotted line mark in polar coordinates

Line_ternary: in a ternary line diagram, each line data_frame is represented as the tip of a dotted mark in ternary coordinates.

Line_mapbox: map line map in the Mapbox chart, each line data_frame is represented as the top of the line mark on the Mapbox map.

Line_geo: geographical coordinate line map in a geographic line map, each line data_frame is represented as the top of a broken line mark on the map

Parallel_coordinates: in a parallel coordinate graph, each row of data_frame is represented by a broken line mark, which is separated into parallel axes, and each parallel axis corresponds to the size of a parallel axis.

Parallel_categories: in a parallel category (or parallel set) diagram, each row data_frame is combined with other rows that share the same value, and the size is then aligned to a broken line mark by a parallel axis, with each parallel axis corresponding to a size.

Area: stacked area map in a stacked area map, each row of data_frame is represented as the tip of a broken line marker in 2D space. The area between successive broken lines is filled.

Bar: in a bar chart, each row of data_frame is represented as a rectangular mark

Bar_polar: a polar bar chart in which each row is represented by a data_frame as a wedge mark in polar coordinates

Violin Picture: in a violin picture, each line of data_frame is marked with a curve, and the brake visualizes its distribution.

Box: in a box chart, each line of the data_frame is grouped together to form a box whisker to show their distribution.

Strip: in a bar chart, each row of data_frame is represented as a principal axis marker in a category; l

Histogram: in a histogram, each line of data_frame is grouped together into a rectangular marker to visualize the 1D distribution y (or x, if orientation is'h') of the aggregate function histfunc (for example, count or sum) of the value.

Choropleth: an equal height (value) area map in which each row of data_frame is represented by a color area mark on the map.

Render an animated scatter chart

The chart to draw the scatter chart is: scatter, the detailed code is as follows:

Import plotly.express as pxdf = px.data.gapminder () px.scatter (df, x = "gdpPercap", y = "lifeExp", animation_frame= "year", animation_group= "country", size= "pop", color= "continent", hover_name= "country", log_x=True, size_max=55, range_x= [100m 100000], range_y= [25je 90])

The display results are as follows:

Animated bar chart import plotly.express as pxdf = px.data.gapminder () fig = px.bar (df, x = "continent", y = "pop", color= "continent", animation_frame= "year", animation_group= "country", range_y= [0jie 400000000]) fig.show () so far, the study on "how to use Python Plotly" is over. I hope I can solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report