:small_red_triangle: Ternary plotting library for python with matplotlib

Overview

python-ternary

DOI Join the chat at https://gitter.im/marcharper/python-ternary

This is a plotting library for use with matplotlib to make ternary plots plots in the two dimensional simplex projected onto a two dimensional plane.

The library provides functions for plotting projected lines, curves (trajectories), scatter plots, and heatmaps. There are several examples and a short tutorial below.

Gallery




Last image from: Genetic Drift and Selection in Many-Allele Range Expansions.

See the citations below for more example images.

Citations and Recent Usage in Publications

DOI

Have you used python-ternary in a publication? Open a PR or issue to include your citations or example plots!

See the partial list of citations and instructions on how to cite.

Installation

Anaconda

You can install python-ternary with conda:

conda config --add channels conda-forge
conda install python-ternary

See here for more information.

Pip

You can install the current release (1.0.6) with pip:

    pip install python-ternary

With setup.py

Alternatively you can clone the repository and run setup.py in the usual manner:

    git clone [email protected]:marcharper/python-ternary.git
    cd python-ternary
    python setup.py install

Usage, Examples, Plotting Functions

You can explore some of these examples with this Jupyter notebook.

The easiest way to use python-ternary is with the wrapper class TernaryAxesSubplot, which mimics Matplotlib's AxesSubplot. Start with:

    fig, tax = ternary.figure()

With a ternary axes object tax you can use many of the usual matplotlib axes object functions:

    tax.set_title("Scatter Plot", fontsize=20)
    tax.scatter(points, marker='s', color='red', label="Red Squares")
    tax.legend()

Most drawing functions can take standard matplotlib keyword arguments such as linestyle and linewidth. You can use LaTeX in titles and labels.

If you need to act directly on the underlying matplotlib axes, you can access them easily:

    ax = tax.get_axes()

You can also wrap an existing Matplotlib AxesSubplot object:

    figure, ax = pyplot.subplots()
    tax = ternary.TernaryAxesSubplot(ax=ax)

This is useful if you want to use ternary as a part of another figure, such as

    from matplotlib import pyplot, gridspec

    pyplot.figure()
    gs = gridspec.GridSpec(2, 2)
    ax = pyplot.subplot(gs[0, 0])
    figure, tax = ternary.figure(ax=ax)
    ...

Some ternary functions expect the simplex to be partitioned into some number of steps, determined by the scale parameter. A few functions will do this partitioning automatically for you, but when working with real data or simulation output, you may have partitioned already. If you are working with probability distributions, just use scale=1 (the default). Otherwise the scale parameter effectively controls the resolution of many plot types (e.g. heatmaps).

TernaryAxesSubplot objects keep track of the scale, axes, and other parameters, supplying them as needed to other functions.

Simplex Boundary and Gridlines

The following code draws a boundary for the simplex and gridlines.

    import ternary

    ## Boundary and Gridlines
    scale = 40
    figure, tax = ternary.figure(scale=scale)

    # Draw Boundary and Gridlines
    tax.boundary(linewidth=2.0)
    tax.gridlines(color="black", multiple=5)
    tax.gridlines(color="blue", multiple=1, linewidth=0.5)

    # Set Axis labels and Title
    fontsize = 20
    tax.set_title("Simplex Boundary and Gridlines", fontsize=fontsize)
    tax.left_axis_label("Left label $\\alpha^2$", fontsize=fontsize)
    tax.right_axis_label("Right label $\\beta^2$", fontsize=fontsize)
    tax.bottom_axis_label("Bottom label $\\Gamma - \\Omega$", fontsize=fontsize)

    # Set ticks
    tax.ticks(axis='lbr', linewidth=1)

    # Remove default Matplotlib Axes
    tax.clear_matplotlib_ticks()

    ternary.plt.show()

Drawing lines

You can draw individual lines between any two points with line and lines parallel to the axes with horizonal_line, left_parallel_line, and right_parallel_line:

    import ternary
    
    scale = 40
    figure, tax = ternary.figure(scale=scale)
    
    # Draw Boundary and Gridlines
    tax.boundary(linewidth=2.0)
    tax.gridlines(color="blue", multiple=5)
    
    # Set Axis labels and Title
    fontsize = 12
    offset = 0.14
    tax.set_title("Various Lines\n", fontsize=fontsize)
    tax.right_corner_label("X", fontsize=fontsize)
    tax.top_corner_label("Y", fontsize=fontsize)
    tax.left_corner_label("Z", fontsize=fontsize)
    tax.left_axis_label("Left label $\\alpha^2$", fontsize=fontsize, offset=offset)
    tax.right_axis_label("Right label $\\beta^2$", fontsize=fontsize, offset=offset)
    tax.bottom_axis_label("Bottom label $\\Gamma - \\Omega$", fontsize=fontsize, offset=offset)
    
    # Draw lines parallel to the axes
    tax.horizontal_line(16)
    tax.left_parallel_line(10, linewidth=2., color='red', linestyle="--")
    tax.right_parallel_line(20, linewidth=3., color='blue')

    # Draw an arbitrary line, ternary will project the points for you
    p1 = (22, 8, 10)
    p2 = (2, 22, 16)
    tax.line(p1, p2, linewidth=3., marker='s', color='green', linestyle=":")
    
    tax.ticks(axis='lbr', multiple=5, linewidth=1, offset=0.025)
    tax.get_axes().axis('off')
    tax.clear_matplotlib_ticks()
    tax.show()

The line drawing functions accept the matplotlib keyword arguments of Line2D.

Curves

Curves can be plotted by specifying the points of the curve, just like matplotlib's plot. Simply use:

    ternary.plot(points)

Points is a list of tuples or numpy arrays, such as [(0.5, 0.25, 0.25), (1./3, 1./3, 1./3)],

    import ternary

    ## Sample trajectory plot
    figure, tax = ternary.figure(scale=1.0)
    tax.boundary()
    tax.gridlines(multiple=0.2, color="black")
    tax.set_title("Plotting of sample trajectory data", fontsize=20)
    points = []
    # Load some data, tuples (x,y,z)
    with open("sample_data/curve.txt") as handle:
        for line in handle:
            points.append(list(map(float, line.split(' '))))
    # Plot the data
    tax.plot(points, linewidth=2.0, label="Curve")
    tax.ticks(axis='lbr', multiple=0.2, linewidth=1, tick_formats="%.1f")
    tax.legend()
    tax.show()

There are many more examples in this paper.

Scatter Plots

Similarly, ternary can make scatter plots:

    import ternary

    ### Scatter Plot
    scale = 40
    figure, tax = ternary.figure(scale=scale)
    tax.set_title("Scatter Plot", fontsize=20)
    tax.boundary(linewidth=2.0)
    tax.gridlines(multiple=5, color="blue")
    # Plot a few different styles with a legend
    points = random_points(30, scale=scale)
    tax.scatter(points, marker='s', color='red', label="Red Squares")
    points = random_points(30, scale=scale)
    tax.scatter(points, marker='D', color='green', label="Green Diamonds")
    tax.legend()
    tax.ticks(axis='lbr', linewidth=1, multiple=5)

    tax.show()

Heatmaps

Ternary can plot heatmaps in two ways and three styles. Given a function, ternary will evaluate the function at the specified number of steps (determined by the scale, expected to be an integer in this case). The simplex can be split up into triangles or hexagons and colored according to one of three styles:

  • Triangular -- triangular: coloring triangles by summing the values on the vertices
  • Dual-triangular -- dual-triangular: mapping (i,j,k) to the upright triangles △ and blending the neigboring triangles for the downward triangles ▽
  • Hexagonal -- hexagonal: which does not blend values at all, and divides the simplex up into hexagonal regions

The two triangular heatmap styles and the hexagonal heatmap style can be visualized as follows: left is triangular, right is dual triangular.



Thanks to chebee7i for the above images.

Let's define a function on the simplex for illustration, the Shannon entropy of a probability distribution:

    def shannon_entropy(p):
        """Computes the Shannon Entropy at a distribution in the simplex."""
        s = 0.
        for i in range(len(p)):
            try:
                s += p[i] * math.log(p[i])
            except ValueError:
                continue
        return -1.*s

We can get a heatmap of this function as follows:

    import ternary
    scale = 60

    figure, tax = ternary.figure(scale=scale)
    tax.heatmapf(shannon_entropy, boundary=True, style="triangular")
    tax.boundary(linewidth=2.0)
    tax.set_title("Shannon Entropy Heatmap")

    tax.show()

In this case the keyword argument boundary indicates whether you wish to evaluate points on the boundary of the partition (which is sometimes undesirable). Specify style="hexagonal" for hexagons. Large scalings can use a lot of RAM since the number of polygons rendered is O(n^2).

You may specify a matplotlib colormap (an instance or the colormap name) in the cmap argument.


Ternary can also make heatmaps from data. In this case you need to supply a dictionary mapping (i, j) or (i, j, k) for i + j + k = scale to a float as input for a heatmap. It is not necessary to include k in the dictionary keys since it can be determined from scale, i, and j. This reduces the memory requirements when the partition is very fine (significant when scale is in the hundreds).

Make the heatmap as follows:

    ternary.heatmap(data, scale, ax=None, cmap=None)

or on a TernaryAxesSubplot object:

    tax.heatmap(data, cmap=None)

This can produces images such as:


Axes Ticks and Orientations

For a given ternary plot there are two valid ways to label the axes ticks corresponding to the clockwise and counterclockwise orientations. However note that the axes labels need to be adjusted accordingly, and ternary does not do so automatically when you pass clockwise=True to tax.ticks().

There is a more detailed discussion on issue #18 (closed).

RGBA colors

You can alternatively specify colors as rgba tuples (r, g, b, a) (all between zero and one). To use this feature, pass colormap=False to heatmap() so that the library will not attempt to map the tuple to a value with a matplotlib colormap. Note that this disables the inclusion of a colorbar. Here is an example:

import math
from matplotlib import pyplot as plt
import ternary

def color_point(x, y, z, scale):
    w = 255
    x_color = x * w / float(scale)
    y_color = y * w / float(scale)
    z_color = z * w / float(scale)
    r = math.fabs(w - y_color) / w
    g = math.fabs(w - x_color) / w
    b = math.fabs(w - z_color) / w
    return (r, g, b, 1.)


def generate_heatmap_data(scale=5):
    from ternary.helpers import simplex_iterator
    d = dict()
    for (i, j, k) in simplex_iterator(scale):
        d[(i, j, k)] = color_point(i, j, k, scale)
    return d


scale = 80
data = generate_heatmap_data(scale)
figure, tax = ternary.figure(scale=scale)
tax.heatmap(data, style="hexagonal", use_rgba=True)
tax.boundary()
tax.set_title("RGBA Heatmap")
plt.show()

This produces the following image:

Unittests

You can run the test suite as follows:

python -m unittest discover tests

Contributing

Contributions are welcome! Please share any nice example plots, contribute features, and add unit tests! Use the pull request and issue systems to contribute.

Selected Contributors

  • Marc Harper marcharper: maintainer
  • Bryan Weinstein btweinstein: Hexagonal heatmaps, colored trajectory plots
  • chebee7i: Docs and figures, triangular heatmapping
  • Cory Simon: Axis Colors, colored heatmap example

Known-Issues

At one point there was an issue on macs that causes the axes labels not to render. The workaround is to manually call

tax._redraw_labels()

before showing or rendering the image.

Comments
  • Added left,right,top_corner_label methods

    Added left,right,top_corner_label methods

    Added left,right,top_corner_label methods to allow labeling of ternary plot at each corner instead of along each axis. Folks in geology tend to draw plots this way. Future work might make the positioning of the labels within the canvas.

    enhancement 
    opened by ZGainsforth 13
  • Ticks orientation

    Ticks orientation

    Im sorry for post this issue as it has been discussed before but things does not work the way i expected.

    import pylab as p
    import ternary as t
    
    figure, d=t.figure(scale=1)
    
    d.boundary(linewidth=2.0)
    d.gridlines(multiple=0.1,color="blue",linewidth=0.8)
    
    d.set_title(r"source flavour composition $\nu_e,\nu_\mu,\nu_\tau$",fontsize=20)
    d.left_axis_label(r"$\nu_\tau$",fontsize=20,offset=0.12)
    d.right_axis_label(r"$\nu_\mu$",fontsize=20)
    d.bottom_axis_label(r"$\nu_e$",fontsize=20)
    d._redraw_labels()
    
    d.ticks(axis='brl',multiple=0.1)
    p.axis('off')
    point1=[(0.34669820676138435,0.3336302826666826,0.31967151057193305)]
    d.scatter(point1, marker='D', color='green', label=r"$(\frac{1}{3},\frac{2}{3},0)$")
    d.resize_drawing_canvas(scale=1.05)
    d.legend()
    d.show()
    

    untitled

    from the plot above, the point i plotted corresponds to the 3 value in point1, but if I were to read off from the plot the ticks labels are reversed. from @marcharper u suggested adding an argument to ticks, so i tried but it gave me error when i replace the ticks line to

    d.ticks(axis='brl',multiple=0.1,ticks=[1.0, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1, 0.0])
    

    TypeError: 'NoneType' object is not iterable

    apologies again as this has been discuss before, but is annoying that the orientation of tick does not show the correct value I'm plotting.

    edit: the value in point 1 correspond nu e,mu,tau respectively.

    opened by hareyakana 13
  • Counterclockwise coordinates and coordinate API, improve relevant documentation

    Counterclockwise coordinates and coordinate API, improve relevant documentation

    Re: issue #13 , determine how to allow users to specify the plotting coordinates and direction. Currently we have "012" for counterclockwise plotting of the three coordinates (as described in #13).

    enhancement 
    opened by marcharper 12
  • User-Specified Coordinate System

    User-Specified Coordinate System

    The current heatmap code places 001 at the lower left, while project_point places 100 at the lower left. My thought was that these conventions should match just in case you want to scatter and color polygons on the same MPL axis.

    More generally, it might be nice if the user could specify which coordinate system to use when plotting. For an upright simplex, we can call the corners left, center, right. The user might designate which coordinate system to use by specifying one of: {'xyz', 'yzx', 'zxy', 'xzy', 'zyx', 'yxz'}. So for 'xyz', x = (1, 0, 0) is assigned to the left corner, y = (0, 1, 0) to the center, and z = (0, 0, 1) to the right corner. 'xyz' is probably going to the preferred one almost always.

    opened by chebee7i 12
  • Floats for ticks

    Floats for ticks

    I've found that 1.0.3 version converts all float ticks to integer which cause example examples/color_coded_heatmap.py to produce ticks 0,0,0,0,0,0,0,0,0,0,1 instead of 0.0,0.1,0.2,...1.0. This does not happen in version 1.0.1.

    opened by fedorn 11
  • Directional Ternary

    Directional Ternary

    Hi @marcharper (and others),

    I'm doing a ternary phase diagram, but I would like the colour to represent direction. So, I have x,y,z data for the three different ternary axes, but I also have x,y,z data for the colour map. I was hoping to plot the x,y,z as r,b,g and alpha (where alpha is transparency and would correspond to a magnitude). Any ideas on how I could do this?

    Thanks, Fred

    opened by fredmarlton 10
  • incompatible bar label

    incompatible bar label

    Dear Marc,

    I am trying your example code colorbar_kwargs.py for my system. I am willing to plot my ternary phase diagram with calculated free energies. I have tried for some test case and realized that the free energy (i.e scatter points c values) are not really compatible with bar label. For instance, I have selected 3 points with 0, -5 and -9.5 values (in vmin=-10, vmax=0 range ). `# Scatter some points points = [(2,3,5),(2,1,7),(2,5,2)] c = [0, -5, -9.5]

    cb_kwargs = {"shrink" : 0.6, "orientation" : "horizontal", "fraction" : 0.1, "pad" : 0.05, "aspect" : 30}

    tax.scatter(points,marker='s',c=c,edgecolor='k',s=80,linewidths=0.5, vmin=-10, vmax=0, colorbar=True,colormap='jet',cbarlabel='Free Energy (eV)', cb_kwargs=cb_kwargs,zorder=3)`

    Under that circumstances I suppose to have blue, green and red circles in the phase diagram, but this is not the case as seen in the image attached.

    If you can give me a feedback, I will be appreciated. Thanks, Halil

    test

    bug 
    opened by halilSozen 10
  • Alternative Mapping for Heatmaps

    Alternative Mapping for Heatmaps

    Attached is crude plot of my understanding for how the heatmaps are calculated using triangular lattices. Essentially, each point is assigned to the lower-left corner of an upright triangle. The upside-down triangles are the averages of the upright triangles around them.

    This makes sense and is probably the easiest thing to do, but the result can be a bit counter intuitive in that a grid at scale s was put on the simplex while a grid at scale s+1 is used for coloring. As an alternative, it might be nice to color each triangle to be the average of the points around it at the same scale (as shown in the bottom diagram). I might be able to tackle this in a week or so, but I thought I'd open an issue anyway.

    text5973

    opened by chebee7i 10
  • Are the ticks oriented incorrectly?

    Are the ticks oriented incorrectly?

    Place your finger somewhere in the interior of the triangle. The way the ticks angle into the boundary of the triangle (the axes) suggests that the composition does not add up to 1.0... I think the ticks are oriented in incorrect angles. Am I right?

    tertiary_diagram

    import ternary
    scale = 10
    
    figure, tax = ternary.figure(scale=scale)
    tax.left_axis_label("Component 1", offset=0.15)
    tax.right_axis_label("Component 0", offset=0.15)
    tax.bottom_axis_label("Component 2", offset=-0.05)
    tax.heatmapf(iast_loadings_component_0, boundary=False, 
                 style="hexagonal", cmap=plt.cm.get_cmap("Blues"), vmax=10.0, vmin=0.0)
    tax.boundary(linewidth=2.0)
    tax.gridlines(color="blue", multiple=1) # Every 5th gridline, can be a float
    # Set ticks
    # tax.ticks(axis='lbr', color="black", linewidth=1)
    tax.ticks(axis='lbr', color="black", linewidth=1, locations=np.arange(scale+1),
             ticks=["%.1f" % (1.0 * i / scale) for i in range(scale+1)], offset=0.03)
    # Remove default Matplotlib Axes
    # tax.line(p1, p2, linewidth=3., marker='s', color='green', linestyle=":")
    tax._redraw_labels()
    tax.set_title("Uptake, component 1", y=1.08)
    
    tax.clear_matplotlib_ticks()
    plt.tight_layout()
    plt.savefig("Tertiary_diagram.png", format='png', dpi=300, facecolor=fig.get_facecolor())
    tax.show()
    
    opened by CorySimon 8
  • python3.5 ipython4 ternary.figure error

    python3.5 ipython4 ternary.figure error

    I try implement the example of your README.md but I get this tracebak:

    from matplotlib import pyplot
    import ternary
    
    ## Boundary and Gridlines
    scale = 40
    figure, tax = ternary.figure(scale=scale)
    
    # Draw Boundary and Gridlines
    tax.boundary(color="black", linewidth=2.0)
    tax.gridlines(color="blue", multiple=5) # Every 5th gridline, can be a float
    
    # Set Axis labels and Title
    fontsize = 20
    tax.set_title("Simplex Boundary and Gridlines", fontsize=fontsize)
    tax.left_axis_label("Left label $\\alpha^2$", fontsize=fontsize)
    tax.right_axis_label("Right label $\\beta^2$", fontsize=fontsize)
    tax.bottom_axis_label("Bottom label $\\Gamma - \\Omega$", fontsize=fontsize)
    
    # Set ticks
    ternary_ax.ticks(axis='lbr', color="black", linewidth=1)
    
    # Remove default Matplotlib Axes
    tax.clear_matplotlib_ticks()
    
    pyplot.show()
    ---------------------------------------------------------------------------
    AttributeError                            Traceback (most recent call last)
    <ipython-input-9-081775008589> in <module>()
          4 ## Boundary and Gridlines
          5 scale = 40
    ----> 6 figure, tax = ternary.figure(scale=scale)
          7 
          8 # Draw Boundary and Gridlines
    
    AttributeError: module 'ternary' has no attribute 'figure'
    
    opened by mmngreco 8
  • Ask: Sharing the same color-bar between several ternary graphs

    Ask: Sharing the same color-bar between several ternary graphs

    I want to share color-bar between several ternary graphs which have individual value-range. For example, value-range of graph A is (0, 67), value-range of graph B is (65, 202) I want the color-bar which fits both of graph A and graph B.

    Now, I have two color-bars and set of (color and number) does not match between A and B

    opened by akinori8888 7
  • Truncation

    Truncation

    This PR includes functionality for truncating the simplex i.e. cutting off one or more corners of the triangle to save whitespace. This has been recently mentioned in #192 and as I've been working on this for some time locally, I thought I'd share this code. I have added an truncated_simplex_example.py to the examples folder which gives a basic tutorial. There are convenience functions for getting and setting the ticks and tick labels which remain after the truncation. Truncation works with or without having set custom axis data limits.

    This works for scatter plots but has not been tested on any of the heatmap plots.

    opened by tgwoodcock 1
  • Blank Heatmap

    Blank Heatmap

    Hi,

    First I wanted to say thank you for creating such a well documented and useful package. I am attempting to use the heatmap() function but my current output is just a blank plot and I'm having trouble understanding why. I tried creating a dictionary where I mapped points to random values instead of the actual data I'm attempting to plot to see if it was an issue with my data but that's not working either. I think I'm likely doing something silly (maybe in my data generation?) but am pretty stuck and would appreciate any insight. As a note I'm omitting the boundaries where a coordinate is 0 because the distribution I hope to eventually plot behaves weirdly there, but this is something I intend to address later. Here's the code snippet:

    import pandas as pd import numpy as np import matplotlib.pyplot as plt import ternary import random

    def gen_rand_data(f1_list_all=np.linspace(0,1,100)): data = {} for f1 in f1_list_all: if f1 != 0: f2_list=f1_list_all[np.where(f1_list_all< 1-f1)] f1_list=f1*np.ones(f2_list.shape[0])

            for f2 in f2_list:
                if f2 > 0:
                    val=random.uniform(0, 1)
                    data[(f1, f2)] = val
                    color=ternary.colormapping.colormapper(val) #testing to see that function converts to colors.
                    print(color)
    #print(data)
    return data
    

    def main(): f1_list_all=np.linspace(0,1,100) #data, Z=gen_data(f1_list_all) data = gen_rand_data(f1_list_all=np.linspace(0,1,100))

    scale = 1
    
    fig, ax = plt.subplots()
    ax.axis("off")
    figure, tax = ternary.figure(ax=ax, scale=scale)
    
    tax.heatmap(data, cmap=None)
    
    axes_colors = {'b': 'g', 'l': 'r', 'r': 'b'}
    tax.boundary(linewidth=2.0)
    
    tax.left_axis_label("$f_1$", offset=0.16)
    tax.right_axis_label("$f_2$", offset=0.16)
    tax.bottom_axis_label("$f_3$", offset=0.06)
    
    tax.gridlines(multiple=1, linewidth=2,
              horizontal_kwargs={'color': axes_colors['b']},
              left_kwargs={'color': axes_colors['l']},
              right_kwargs={'color': axes_colors['r']},
              alpha=0.7)
    
    # Set and format axes ticks.
    ticks = [i / float(scale) for i in range(scale+1)]
    tax.ticks(ticks=ticks, axis='rlb', linewidth=1, clockwise=True,
          axes_colors=axes_colors, offset=0.03, tick_formats="%0.1f")
    
    tax.clear_matplotlib_ticks()
    tax._redraw_labels()
    plt.tight_layout()
    tax.show()
    figure.savefig('simplex_plot.png')
    

    Thank you!

    opened by sdebesai 3
  • TernaryAxesSubplot.scatter() skips first default color in version 1.0.8

    TernaryAxesSubplot.scatter() skips first default color in version 1.0.8

    Description

    The TernaryAxesSubplot.scatter() method skips the first color of the default matplotlib colormap in version 1.0.8.

    Steps to reproduce

    import ternary
    
    fig, tax = ternary.figure(scale=1)
    tax.scatter([(1.1/3, 0.9/3, 1/3)], label="first")
    tax.scatter([(0.9/3, 1.1/3, 1/3)], label="second")
    tax.legend()
    tax.set_title(f"python-ternary {ternary.__version__}")
    tax.show()
    

    Expect behavior

    The default matplotlib colors are used starting with blue, followed by orange, etc. This is the behavior with version 1.0.7:

    image

    Actual behavior

    The first scatter plot uses the second default matplotlib color (orange), followed by the third (green), etc.:

    image

    Notes

    Matplotlib version used in both cases above: 3.5.2

    opened by DrGFreeman 1
  • Cut off top of triangle?

    Cut off top of triangle?

    Hello!

    First, thank you so much for making this package - it's so helpful! I am a geologist, and we often use ternary diagrams with the top cut off, such as the plot below (purely an example I got from the internet).

    image

    I am struggling to replicate this with your packages. I am using subplots, so I can control the height of the axes using ax.set_ylim, but this just stretches the ternary (example below), and leaves some of the ternary tick marks stretched out above the plot. Is there a way to plot only part of a ternary axis?

    strechingproblemexample

    Basically, I guess I want to do something like the last part of the solution to #190 but without the free floating ticks.

    Thank you! M

    opened by Peacemoose10 5
  • add option to scale heatmap vmin and vmax based on avg. computed values

    add option to scale heatmap vmin and vmax based on avg. computed values

    Added an option to all the relevant heatmap functions adj_vlims which will automatically scale the min and max values of the colormap used in the heatmap based on the min and max averaged values that are actually plotted on the heatmap.

    opened by fairliereese 1
Releases(1.0.8)
Owner
Marc
Data Scientist
Marc
Python package for the analysis and visualisation of finite-difference fields.

discretisedfield Marijan Beg1,2, Martin Lang2, Samuel Holt3, Ryan A. Pepper4, Hans Fangohr2,5,6 1 Department of Earth Science and Engineering, Imperia

ubermag 12 Dec 14, 2022
DataVisualization - The evolution of my arduino and python journey. New level of competence achieved

DataVisualization - The evolution of my arduino and python journey. New level of competence achieved

1 Jan 03, 2022
SummVis is an interactive visualization tool for text summarization.

SummVis is an interactive visualization tool for analyzing abstractive summarization model outputs and datasets.

Robustness Gym 246 Dec 08, 2022
Render Jupyter notebook in the terminal

jut - JUpyter notebook Terminal viewer. The command line tool view the IPython/Jupyter notebook in the terminal. Install pip install jut Usage $jut --

Kracekumar 169 Dec 27, 2022
A concise grammar of interactive graphics, built on Vega.

Vega-Lite Vega-Lite provides a higher-level grammar for visual analysis that generates complete Vega specifications. You can find more details, docume

Vega 4k Jan 08, 2023
A GUI for Pandas DataFrames

About Demo Installation Usage Features More Info About PandasGUI is a GUI for viewing, plotting and analyzing Pandas DataFrames. Demo Installation Ins

Adam Rose 2.8k Dec 24, 2022
Exploratory analysis and data visualization of aircraft accidents and incidents in Brazil.

Exploring aircraft accidents in Brazil Occurrencies with aircraft in Brazil are investigated by the Center for Investigation and Prevention of Aircraf

Augusto Herrmann 5 Dec 14, 2021
This is a Boids Simulation, written in Python with Pygame.

PyNBoids A Python Boids Simulation This is a Boids simulation, written in Python3, with Pygame2 and NumPy. To use: Save the pynboids_sp.py file (and n

Nik 17 Dec 18, 2022
Blender addon that creates a temporary window of any type from the 3D View.

CreateTempWindow2.8 Blender addon that creates a temporary window of any type from the 3D View. Features Can the following window types: 3D View Graph

3 Nov 27, 2022
The plottify package is makes matplotlib plots more legible

plottify The plottify package is makes matplotlib plots more legible. It's a thin wrapper around matplotlib that automatically adjusts font sizes, sca

Andy Jones 97 Nov 04, 2022
Rick and Morty Data Visualization with python

Rick and Morty Data Visualization For this project I looked at data for the TV show Rick and Morty Number of Episodes at a Certain Location Here is th

7 Aug 29, 2022
The visual framework is designed on the idea of module and implemented by mixin method

Visual Framework The visual framework is designed on the idea of module and implemented by mixin method. Its biggest feature is the mixins module whic

LEFTeyes 9 Sep 19, 2022
Fractals plotted on MatPlotLib in Python.

About The Project Learning more about fractals through the process of visualization. Built With Matplotlib Numpy License This project is licensed unde

Akeel Ather Medina 2 Aug 30, 2022
1900-2016 Olympic Data Analysis in Python by plotting different graphs

🔥 Olympics Data Analysis 🔥 In Data Science field, there is a big topic before creating a model for future prediction is Data Analysis. We can find o

Sayan Roy 1 Feb 06, 2022
Because trello only have payed options to generate a RunUp chart, this solves that!

Trello Runup Chart Generator The basic concept of the project is that Corello is pay-to-use and want to use Trello To-Do/Doing/Done automation with gi

Rômulo Schiavon 1 Dec 21, 2021
Small project demonstrating the use of Grafana and InfluxDB for monitoring the speed of an internet connection

Speedtest monitor for Grafana A small project that allows internet speed monitoring using Grafana, InfluxDB 2 and Speedtest. Demo Requirements Docker

Joshua Ghali 3 Aug 06, 2021
Log visualizer for whirl-framework

Lumberjack Log visualizer for whirl-framework Установка pip install -r requirements.txt Как пользоваться python3 lumberjack.py -l путь до лога -o

Vladimir Malinovskii 2 Dec 19, 2022
Automatically visualize your pandas dataframe via a single print! 📊 💡

A Python API for Intelligent Visual Discovery Lux is a Python library that facilitate fast and easy data exploration by automating the visualization a

Lux 4.3k Dec 28, 2022
A command line tool for visualizing CSV/spreadsheet-like data

PerfPlotter Read data from CSV files using pandas and generate interactive plots using bokeh, which can then be embedded into HTML pages and served by

Gino Mempin 0 Jun 25, 2022
Visualizations of linear algebra algorithms for people who want a deep understanding

Visualising algorithms on symmetric matrices Examples QR algorithm and LR algorithm Here, we have a GIF animation of an interactive visualisation of t

ogogmad 3 May 05, 2022