In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Today, I will talk to you about how to use cutecharts in Python. Many people may not know much about it. In order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.
Pip install cutecharts
You can also use source code installation:
$git clone https://github.com/chenjiandongx/cutecharts.git$ cd cutecharts$ pip install-r requirements.txt$ python setup.py install
Here's how to draw each chart.
First of all, there are some parameters common to charts:
Commons
Different charts have some of the same methods.
Init
Render_notebook
Cutecharts.charts.Bar.add_series
Demo
Basic example of Bar-
From cutecharts.charts import Barfrom cutecharts.components import Pagefrom cutecharts.faker import Fakerdef bar_base ()-> Bar: chart = Bar ("Bar- basic example") chart.set_options (labels=Faker.choose (), x-ray label = "Ihumm xlabel", yearly label = "Ihumm ylabel") chart.add_series ("series-A", Faker.values ()) return chartbar_base (). Render ()
Bar- adjust color
Def bar_tickcount_colors (): chart = Bar ("Bar- adjust color") chart.set_options (labels=Faker.choose (), y_tick_count=10, colors=Faker.colors) chart.add_series ("series-A", Faker.values ()) return chart
Line (line chart)
Cutecharts.charts.Line
API
Cutecharts.charts.Line.set_options
Params Desc--labels: Iterable X axis label data x_label: str = "" X axis name Y_label: str = "" Y axis name y_tick_count: int = 3 Y axis scale segments legend_pos: str = "upLeft" legend location There are "upLeft", "upRight", "downLeft", "downRight" optional colors: Optional [Iterable] = None label color array font_family: Optional [str] = None CSS font-family
Cutecharts.charts.Line.add_series
Demo
Basic example of Line-
From cutecharts.charts import Linefrom cutecharts.components import Pagefrom cutecharts.faker import Fakerdef line_base ()-> Line: chart = Line ("Line- basic example") chart.set_options (labels=Faker.choose (), x-ray label = "Ilemm xlabel", yearly label = "Ihumm ylabel") chart.add_series ("series-A", Faker.values ()) chart.add_series ("series-B", Faker.values ()) return chartline_base (). Render ()
Line-Legend location
Def line_legend (): chart = Line ("Line-Legend location") chart.set_options (labels=Faker.choose (), legend_pos= "upRight") chart.add_series ("series-A", Faker.values ()) chart.add_series ("series-B", Faker.values ()) return chart
Line- adjust color
Def line_tickcount_colors (): chart = Line ("Line- adjust color") chart.set_options (labels=Faker.choose (), colors=Faker.colors, y_tick_count=8) chart.add_series ("series-A", Faker.values ()) chart.add_series ("series-B", Faker.values ()) return chart
Pie (pie chart)
Cutecharts.charts.Pie
Cutecharts.charts.Pie.set_options
Params Desc- labels: Iterable data label list inner_radius: float = 0.5 Pie graph radius legend_pos: Str = "upLeft" legend location There are "upLeft", "upRight", "downLeft", "downRight" optional colors: Optional [Iterable] = None label color array font_family: Optional [str] = None CSS font-family
Cutecharts.charts.Pie.add_series
Params Desc--data: Iterable series data list
Demo
Basic example of Pie-
From cutecharts.charts import Piefrom cutecharts.components import Pagefrom cutecharts.faker import Fakerdef pie_base ()-> Pie: chart = Pie ("Pie- basic example") chart.set_options (labels=Faker.choose ()) chart.add_series (Faker.values ()) return chartpie_base () .render ()
Pie-Legend
Def pie_legend_font (): chart = Pie (Pie-Legend) chart.set_options (labels=Faker.choose (), legend_pos= "downLeft", font_family=' "Times New Roman", Georgia,Serif;',) chart.add_series (Faker.values ()) return chart
Pie-Radius
Def pie_radius (): chart = Pie ("Pie-Radius") chart.set_options (labels=Faker.choose (), inner_radius=0,) chart.add_series (Faker.values ()) return chart after reading the above, do you have any further understanding of how to use cutecharts in Python? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.