Python学习笔记(十五)

十六章拓展
plotly express 的渐变

https://blog.csdn.net/tMb8Z9Vdm66wH68VX1/article/details/107421627?ops_request_misc=%7B%22request%5Fid%22%3A%22161175139116780264014887%22%2C%22scm%22%3A%2220140713.130102334.pc%5Fall.%22%7D&request_id=161175139116780264014887&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2allfirst_rank_v2~rank_v29-9-107421627.pc_search_result_cache&utm_term=plotly+express++渐变&spm=1018.2226.3001.4187

保存图片的分辨率

plotly.py 支持静态图片输出。plotly.io.to_image能将plotly 图表转为静态图

import plotly.graph_objs as go
import plotly.io as pio

trace1 = [go.Scatter(x=[1,2,3], y=[4,5,6], marker={'color': 'red', 'symbol': 104, 'size': 10}, 
                    mode="markers+lines",  text=["one","two","three"], name='1st Trace')]
                                               
layout=go.Layout(title="First Plot", xaxis={'title':'x1'}, yaxis={'title':'x2'})
figure=go.Figure(data=trace1,layout=layout)

static_image_bytes = pio.to_image(figure, format='png')

from IPython.display import Image
Image(static_image_bytes)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值