plotly django_使用Plotly为Django HTML页面进行漂亮的可视化

plotly django

Hello everyone! Recently I had to do some visualizations for my university project, I’ve done some googling and haven’t found any simple guides on how to put Plotly plots on an HTML page.

大家好! 最近,我不得不为我的大学项目做一些可视化处理,做了一些谷歌搜索,还没有找到任何有关如何在HTML页面上放置Plotly图的简单指南。

Before we start I assume that you have running the Django HTML page. Why Plotly? Plotly allows you to make interactive, beautifully designed plots in a matter of minutes. Despite that originally Plotly is a Python library, we won’t use any Python programming today.

在开始之前,我假设您已经运行了Django HTML页面。 为什么情节? 通过Plotly,您可以在几分钟内完成交互式 ,设计精美的绘图。 尽管Plotly最初是一个Python库,但今天我们不会使用任何Python编程。

对于那些没有太多时间的人,这里是简短指南: (For those who don’t have much time, here is the short guide:)

  • Go to Plotly Chart Studio, create your account.

    转到Plotly Chart Studio ,创建您的帐户。

  • Click on the “Create” button and choose “Chart”.

    单击“创建”按钮,然后选择“图表”。
  • Import your data and click on the “Trace” button.

    导入数据,然后单击“跟踪”按钮。
  • Choose the type of plot you want.

    选择所需的绘图类型。
  • Once you made your dream-plot, save it, setting all the settings to “Public”.

    完成梦境图后,将其保存,将所有设置都设置为“公共”。
  • Share your plot, by copying iframe code from the “Embed” tab and past it to the body of your HTML page.

    通过从“嵌入”标签复制iframe代码并将其粘贴到HTML页面的正文中,共享绘图。

Now for those who have time, let’s see in detail how we can get the same result, as you saw at the beginning.

现在,对于那些有时间的人,让我们详细了解如何获得与您一开始看到的结果相同的结果。

步骤1.创建一个帐户并上传数据。 (Step 1. Creating an account and uploading the data.)

Image for post
Image by Author
图片作者

We will use Plotly Chart Studio. Once you’ve signed up, you’ll see “Create” in the upper-right corner.

我们将使用Plotly Chart Studio 。 注册后,您会在右上角看到“创建”。

To create our visualizations we have to import our data first. The data can be either CSV, single-sheet Excel file, link to a CSV file or the data got using SQL and Falcon SQL client.

要创建可视化,我们必须首先导入数据。 数据可以是CSV,单页Excel文件,链接到CSV文件或使用SQL和Falcon SQL客户端获取的数据。

Once you uploaded your data, you’ll see it in the table (red square) on the top of your screen.

上传数据后,您会在屏幕顶部的表格(红色正方形)中看到该数据。

Image for post
Plotly Studio, Image by Author
Plotly Studio,作者提供的图片

步骤2.选择图的类型并跟踪数据。 (Step 2. Choosing the type of plot and tracing the data.)

Now let’s look at the blue square on the picture and trace some data.

现在,让我们看一下图片上的蓝色方块并跟踪一些数据。

Image for post
Image by Author
图片作者

You can choose between different types of plots. Here I chose the Choropleth Atlas Map since it allows me to get this nice Earth visualization.

您可以在不同类型的图之间进行选择。 在这里,我选择了Choropleth Atlas地图,因为它可以使我获得很好的地球可视化效果。

步骤3.指定位置和值。 (Step 3. Specifying location and values.)

Then you have to specify columns that will be used as locations and values. You also have to choose the location format, since it can be countries’ names or abbreviations and so on.

然后,您必须指定将用作位置和值的列。 您还必须选择位置格式,因为它可以是国家或地区的名称或缩写等。

Image for post
Image by Author
图片作者

Here you can see all my settings, which you can use to get the same result as mine.

在这里,您可以看到我的所有设置,可以用来获得与我相同的结果。

步骤4.保存和共享图。 (Step 4. Saving and sharing the plot.)

Image for post
Image by Author
图片作者

We are almost there! Click the “Save” button and choose “Public” for Plot and Grid.

我们就快到了! 单击“保存”按钮,然后为“图和网格”选择“公共”。

Image for post
Image by Author
图片作者

Finally, you click the “Share” button, choose “Embed” and copy iframe HTML code, which you can pass in the body of your HTML page.

最后,您点击“共享”按钮,选择“嵌入”并复制iframe HTML代码,您可以将其传递到HTML页面的正文中。

Thank you for reading!

感谢您的阅读!

翻译自: https://towardsdatascience.com/making-beautiful-visualizations-for-a-django-html-page-using-plotly-f4e97d3f6bc7

plotly django

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/389106.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

roce和iwarp_VIA、IB、RDMA、RoCE、iWARP、DPDK的发展与纠缠?

VIA(Virtual Interface Architecture): 这个只是一个标准,基本上不要了解太多。楼主的问题可以细分成2个层次考虑。一个是网络环境,二是具体的协议和实现。一、网络环境IB(InfiniBand): 是一种网络环境,做对比的是以太网, IB往往用于高性能集…

remoting

原文地址:http://blog.csdn.net/chengking/archive/2005/10/26/517349.aspx (一).说明 一个远程调用示例. 此示例实现功能: 客房端调用远程方法(远程方法可以弹 出自定义信息),实现发送信息功能. 实现原理概是这样的…

handler 消息处理机制

关于handler消息处理机制,只要一提到,相信作为一个android工程师,脑海就会有这么一个流程 大家都滚瓜烂熟了,但别人问到几个问题,很多人还是栽到这个“烂”上面,比如: 一个线程是如何对应一个L…

es6简单介绍

let和const 原先声明变量的形式 var test 5; //全局变量 function a() {var cc3; //局部变量alert(test); } function b(){alert(test);}test 5;//全局变量 function a() {aa3; //全局变量alert(test); } 在es6之前,作用域只有全局作用域和函数作用域&#xff0…

软件工程方法学要素含义_日期时间数据的要素工程

软件工程方法学要素含义According to Wikipedia, feature engineering refers to the process of using domain knowledge to extract features from raw data via data mining techniques. These features can then be used to improve the performance of machine learning a…

洛谷P1605:迷宫(DFS)

题目背景 迷宫 【问题描述】 给定一个N*M方格的迷宫,迷宫里有T处障碍,障碍处不可通过。给定起点坐标和终点坐标,问: 每个方格最多经过1次,有多少种从起点坐标到终点坐标的方案。在迷宫中移动有上下左右四种方式,每次只…

vue图片压缩不失真_图片压缩会失真?快试试这几个无损压缩神器。

前端通常在做网页的时候 会出现图片加载慢的情况 在这里我通常会将图片进行压缩 但是通常情况下 观众会认为 图片压缩会出现失真的现象 在这里我会向大家推荐几款图片压缩的工具 基本上会实现无损压缩1.TinyPng地址:https://tinypng.comEnglish?不要慌&a…

remoteing2

此示例主要演示了net remoting,其中包含一个服务器程序Server.exe和一个客户端程序CAOClient.exe。客户端程序会通过http channel调用服务器端RemoteType.dll的对象和方法。服务器端的代码文件由下图所述:Server.cs源代码 :using System;using System.Runtime.Remot…

android 线程池

为什么用线程池 创建/销毁线程伴随着系统开销,过于频繁的创建/销毁线程,会很大程度上影响处理效率 例如: 记创建线程消耗时间T1,执行任务消耗时间T2,销毁线程消耗时间T3 如果T1T3>T2,那么是不是说开…

datatable转化泛型

public class ConvertHelper<T>where T:new() { /// <summary> /// 利用反射和泛型 /// </summary> /// <param name"dt"></param> /// <returns></returns> public static List<T> ConvertToList(DataTable dt) { …

【跃迁之路】【651天】程序员高效学习方法论探索系列(实验阶段408-2018.11.24)...

(收集箱&#xff08;每日一记&#xff0c;每周六整理&#xff09;)专栏 实验说明 从2017.10.6起&#xff0c;开启这个系列&#xff0c;目标只有一个&#xff1a;探索新的学习方法&#xff0c;实现跃迁式成长实验期2年&#xff08;2017.10.06 - 2019.10.06&#xff09;我将以自己…

更换mysql_Docker搭建MySQL主从复制

Docker搭建MySQL主从复制 主从服务器上分别安装Docker 1.1 Docker 要求 CentOS 系统的内核版本高于 3.10 [rootlocalhost ~]# uname -r 3.10.0-693.el7.x86_641.2 确保 yum 包更新到最新。 [rootlocalhost ~]# sudo yum update Loaded plugins: fastestmirror, langpacks Loadi…

dll文件的c++制作dll文件的c++制作

dll文件的c制作1、首先用vs2005建立一个c的dll动态链接库文件&#xff0c;这时&#xff0c;// DllTest.cpp : 定义 DLL 应用程序的入口点。//#include "stdafx.h"//#include "DllTest.h"#ifdef _MANAGED#pragma managed(push, off)#endifBOOL APIENTRY Dll…

理解ConstraintLayout 对性能的好处

自从在17年GoogleI/O大会宣布了Constraintlayout,我们持续提升了布局的稳定性和布局编辑的支持。我们还为ConstraintLayout添加了一些新特性支持创建不同类型的布局&#xff0c;添加这些新特性&#xff0c;可以明显的提升性能&#xff0c;在这里&#xff0c;我门将讨论Contrain…

数据湖 data lake_在Data Lake中高效更新TB级数据的模式

数据湖 data lakeGOAL: This post discusses SQL “UPDATE” statement equivalent for a data lake (object) storage using Apache Spark execution engine. To further clarify consider this, when you need to perform conditional updates to a massive table in a relat…

如何理解运维

运维工程师&#xff08;运营&#xff09;&#xff0c;负责维护并确保整个服务的高可用性&#xff0c;同时不断优化系统架构提升部署效率&#xff0c;优化资源利用率提高整体的投资回报率。运维工程师面对的最大挑战是大规模集群的管理问题&#xff0c;如何管理好几十万台服务器…

advanced installer更换程序id_好程序员web前端培训分享kbone高级-事件系统

好程序员web前端培训分享kbone高级-事件系统&#xff1a;1、用法&#xff0c;对于多页面的应用&#xff0c;在 Web 端可以直接通过 a 标签或者 location 对象进行跳转&#xff0c;但是在小程序中则行不通&#xff1b;同时 Web 端的页面 url 实现和小程序页面路由也是完全不一样…

ai对话机器人实现方案_显然地引入了AI —无代码机器学习解决方案

ai对话机器人实现方案A couple of folks from Obviously.ai contacted me a few days back to introduce their service — a completely no-code machine learning automation tool. I was a bit skeptical at first, as I always am with supposedly fully-automated solutio…

网络负载平衡的

网络负载平衡允许你将传入的请求传播到最多达32台的服务器上&#xff0c;即可以使用最多32台服务器共同分担对外的网络请求服务。网络负载平衡技术保证即使是在负载很重的情况下它们也能作出快速响应。 网络负载平衡对外只须提供一个IP地址&#xff08;或域名&#xff09;。 如…

透明状态栏导致windowSoftInputMode:adjustResize失效问题

当我们通过下面代码&#xff1a; getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); 设置状态栏透明&#xff0c;当界面存在EditText时&#xff0c;在activity里面设置windowSoftInputMode:…