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 Pyecharts to export high-definition pictures and display them dynamically in PPT by python

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces how python uses Pyecharts to export high-definition pictures and dynamically display them in PPT. The article is very detailed and has a certain reference value. Interested friends must finish reading it!

1. Preface

Pyecharts is a class library for generating Echarts diagrams. Echarts is an open source data visualization JS library of Baidu. The visualization effect of the graph generated by Echarts is very good, in order to dock with Python, it is convenient to use the data generation graph directly in Python. Pyecharts can display dynamic graphs, online reports are more beautiful, and display data is convenient, mouse over the chart, you can display values, labels, and so on.

The picture drawn by pyecharts is very beautiful, but how to display it is a problem. The direct screenshot is not very clear. Is there any way to export a clear picture and retain its original functions that can be displayed in a variety of ways?

two。 Export png format picture from pyecharts.charts import Barfrom pyecharts import options as opts # Import and output picture tool from pyecharts.render import make_snapshot# use snapshot-selenium render picture from snapshot_selenium import snapshot# to create a bar chart Bar instance bar = (Bar () # add X axis data .add _ xaxis (["shirt", "cardigan", "chiffon shirt", "trousers", "high heels" "socks"]) # add Y axis data, the name of the series .add _ yaxis ("Merchant A", [5, 20, 36, 10, 75, 90]) .add _ yaxis ("Merchant B", [8, 15, 60, 20, 25, 30]) # add title .set _ global_opts (title_opts=opts.TitleOpts (title= "main title: Singles Day sales") Subtitle= "subtitle: clothing class") # output is saved as picture make_snapshot (snapshot, bar.render (), "Options configuration item _ custom style _ save picture .png")

Execute an error message:

Error message: Message: 'chromedriver' executable needs to be in PATH.Please see https://sites.google.com/a/chromium.org/chromedriver/home.

Reason for error: chromedriver of chrome browser is not configured

Open Google browser and type chrome://version/, to view the version number of your Google browser

Download the portal corresponding to your version number

When the download is complete, put this file in your Google browser directory

After putting it away, copy the address above and add it to your system environment. My computer-Properties-Advanced-system variable-path- add address

Problem solving

3. How to display pyecharts pictures in PPT

First, open PPT and click on the development tools.

Click Miscrosft Web Browser

Okay, remind us that we can't insert the control, and the pain begins.

First, WIN+R, type regeit to open the registry

Find

Computer\ HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ Internet Explorer\ ActiveX Compatibility\ {8856F961-340A-11D0-A96B-00C04FD705A2}

Computer\ HKEY_LOCAL_MACHINE\ SOFTWARE\ WOW6432Node\ Microsoft\ Internet Explorer\ ActiveX Compatibility\ {8856F961-340A-11D0-A96B-00C04FD705A2}

\ HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ Office\ ClickToRun\ REGISTRY\ MACHINE\ Software\ Office\ 16.0\ Common\ COM Compatibility\ {8856F961-340A-11D0-A96B-00C04FD705A2}

These three locations change the Compatibility Flags key value 21 to 16-bit 0 (summary: it is troublesome to find this, and each computer installs it differently. Some registry locations are not here yet. It is recommended to directly search {8856F961-340A-11D0-A96B-00C04FD705A2}, keep only entries, and then find them. Just change these three.)

After the change is completed, the problem is solved, and the Miscrosft Web Browser can be loaded normally.

Select the red command line and draw a command button below, click the button, and insert WebBrowser1.Navigate (here is your address)

Play a slide show

And then report an error, emmmm.

Load the code in the html code of the echarts chart (at least 9 or more at *) and set HTML to the kernel of IE.

Try again. The problem is finally solved.

Although the problem-solving process is more tedious, it is still a great help to the day-to-day.

The above is all the contents of the article "how python uses Pyecharts to export high-definition pictures and dynamically display them in PPT". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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

Development

Wechat

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

12
Report