日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > HTML >内容正文

HTML

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

發布時間:2023/11/29 HTML 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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 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.

上傳數據后,您會在屏幕頂部的表格(紅色正方形)中看到該數據。

Plotly Studio, Image by AuthorPlotly 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 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 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 by Author圖片作者

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

我們就快到了! 單擊“保存”按鈕,然后為“圖和網格”選擇“公共”。

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

總結

以上是生活随笔為你收集整理的plotly django_使用Plotly为Django HTML页面进行漂亮的可视化的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。