4

Changing the Pixel Size

 2 years ago
source link: https://datacrayon.com/posts/plotapi/terminus/changing-the-pixel-size/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Preamble

from plotapi import Terminus

Terminus.set_license("your username", "your license key")

Introduction

The Terminus pixel size can be modified to improve the presentation of our diagram, this works as intended in both WebGL and D3.js canvas mode.

As we can see, we have set our license details in the preamble with Terminus.set_license().

Dataset

Terminus expects a list of dictionary items, these will define the flow of pixels between a source and a target.

links = [
    {"source":"England", "target":"Germany", "value": 1000},
    {"source":"England", "target":"France", "value": 3000},
    {"source":"England", "target":"Spain", "value": 5000},
    {"source":"England", "target":"Italy", "value": 4000},
    {"source":"England", "target":"Japan", "value": 800},

    
    {"source":"Ireland", "target":"Germany", "value": 3500},
    {"source":"Ireland", "target":"France", "value": 3750},
    {"source":"Ireland", "target":"Spain", "value": 1750},
    {"source":"Ireland", "target":"Italy", "value": 5000},
    {"source":"Ireland", "target":"Japan", "value": 400},
]

We can add many source's and target's! As they increase, we may need to adjust Terminus layout properties to accomodate the diagram's size and throughput.

Visualisation

To change the pixel size, we simply change the value of pixel_size.

Let's try a pixel size smaller than the default setting.

Here we're using .show() which outputs to a Jupyter Notebook cell, however, we may want to output to an HTML file with .to_html() instead. More on the different output methods later!

Terminus(links, pixel_size=2).show()

Plotapi - Terminus Diagram

EnglandIrelandGermanyFranceSpainItalyJapan00%00%00%00%00%England00%00%00%00%00%Ireland

You can do so much more than what's presented in this example, and this is covered in other sections. If you want to see the full list of growing features, check out the Plotapi API Documentation.


Recommend

  • 62
    • www.tuicool.com 6 years ago
    • Cache

    Gluon – A pocket-size BEAM VM

    THE NEXT BIG small THING™ Gluon Erlang Abstract Machine A configurable and small virtual machine whi...

  • 186
    • www.tuicool.com 6 years ago
    • Cache

    Gluon — A pocket-size BEAM VM

    Presenting a hobby project that I’ve been doing for several months now. It is named after “gluon”, a particle which acts as the exchange particle for the strong force betwe...

  • 43
    • Github github.com 6 years ago
    • Cache

    GitHub - google/cocoapods-size

    README.md CocoaPods Size Measurement According to

  • 46

    Website monitoring without the hassle. Multi-location uptime monitoring, broken links detection & ssl certificate expiration reporting.

  • 28
    • www.tuicool.com 5 years ago
    • Cache

    Let’s Make Our Bundle Size Even Smaller

    If you ever developed a SPA (Single-Page-Application), where ever it was on Angular, React, Vue or something else, You probably noticed that all the hard work you’ve put into your app goes to one minified .js file and one...

  • 37
    • www.tuicool.com 5 years ago
    • Cache

    Towards Size Types in Futhark

    Posted on August 3, 2019 by Troels Henriksen Futhark is not a large or particularly innovative language. We prefer to keep the novelties in the compiler, and only include language features that have...

  • 9

    April 16, 2013Changing the size of a paging scroll view There aren’t really any good names for this effect, but at some point every app developer wants to make it. You can see it in Safari on iOS, when you zoo...

  • 7

    The 'best' Pixel experience now only comes in one size By Taylor Kerns Published 1 day ago This generation may be doubly disa...

  • 7
    • www.gsmarena.com 2 years ago
    • Cache

    Google Pixel Watch's battery size leaks

    Google Pixel Watch's battery size leaks The Pixel Watch leaks campaign is now in full force ahead of its probable announcement at Google I...

  • 0

    What you need to knowGoogle is releasing a Super Bowl ad this year that follows the story of a blind man and his girlfriend while highlighting the Guided Frame feature.On Pixel phones, Guided Fra...

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK