: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
NorthPitch is a python soccer plotting library that sits on top of Matplotlib

NorthPitch is a python soccer plotting library that sits on top of Matplotlib.

Devin Pleuler 30 Feb 22, 2022
A Python library for plotting hockey rinks with Matplotlib.

Hockey Rink A Python library for plotting hockey rinks with Matplotlib. Installation pip install hockey_rink Current Rinks The following shows the cus

null 24 Jan 2, 2023
MPL Plotter is a Matplotlib based Python plotting library built with the goal of delivering publication-quality plots concisely.

MPL Plotter is a Matplotlib based Python plotting library built with the goal of delivering publication-quality plots concisely.

Antonio López Rivera 162 Nov 11, 2022
matplotlib: plotting with Python

Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python. Check out our home page for more inform

Matplotlib Developers 16.7k Jan 8, 2023
matplotlib: plotting with Python

Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python. Check out our home page for more inform

Matplotlib Developers 13.1k Feb 18, 2021
🎨 Python Echarts Plotting Library

pyecharts Python ❤️ ECharts = pyecharts English README ?? 简介 Apache ECharts (incubating) 是一个由百度开源的数据可视化,凭借着良好的交互性,精巧的图表设计,得到了众多开发者的认可。而 Python 是一门富有表达

pyecharts 13.1k Jan 3, 2023
🎨 Python Echarts Plotting Library

pyecharts Python ❤️ ECharts = pyecharts English README ?? 简介 Apache ECharts (incubating) 是一个由百度开源的数据可视化,凭借着良好的交互性,精巧的图表设计,得到了众多开发者的认可。而 Python 是一门富有表达

pyecharts 10.6k Feb 18, 2021
termplotlib is a Python library for all your terminal plotting needs.

termplotlib termplotlib is a Python library for all your terminal plotting needs. It aims to work like matplotlib. Line plots For line plots, termplot

Nico Schlömer 553 Dec 30, 2022
Plotting library for IPython/Jupyter notebooks

bqplot 2-D plotting library for Project Jupyter Introduction bqplot is a 2-D visualization system for Jupyter, based on the constructs of the Grammar

null 3.4k Dec 29, 2022
An intuitive library to add plotting functionality to scikit-learn objects.

Welcome to Scikit-plot Single line functions for detailed visualizations The quickest and easiest way to go from analysis... ...to this. Scikit-plot i

Reiichiro Nakano 2.3k Dec 31, 2022
🎨 Python3 binding for `@AntV/G2Plot` Plotting Library .

PyG2Plot ?? Python3 binding for @AntV/G2Plot which an interactive and responsive charting library. Based on the grammar of graphics, you can easily ma

hustcc 990 Jan 5, 2023
Plotting library for IPython/Jupyter notebooks

bqplot 2-D plotting library for Project Jupyter Introduction bqplot is a 2-D visualization system for Jupyter, based on the constructs of the Grammar

null 3.4k Dec 30, 2022
An open-source plotting library for statistical data.

Lets-Plot Lets-Plot is an open-source plotting library for statistical data. It is implemented using the Kotlin programming language. The design of Le

JetBrains 820 Jan 6, 2023
Plotting library for IPython/Jupyter notebooks

bqplot 2-D plotting library for Project Jupyter Introduction bqplot is a 2-D visualization system for Jupyter, based on the constructs of the Grammar

null 3k Feb 18, 2021
An open-source plotting library for statistical data.

Lets-Plot Lets-Plot is an open-source plotting library for statistical data. It is implemented using the Kotlin programming language. The design of Le

JetBrains 509 Feb 17, 2021
A deceptively simple plotting library for Streamlit

?? Plost A deceptively simple plotting library for Streamlit. Because you've been writing plots wrong all this time. Getting started pip install plost

Thiago Teixeira 192 Dec 29, 2022
Simple plotting for Python. Python wrapper for D3xter - render charts in the browser with simple Python syntax.

PyDexter Simple plotting for Python. Python wrapper for D3xter - render charts in the browser with simple Python syntax. Setup $ pip install PyDexter

D3xter 31 Mar 6, 2021
Cartopy - a cartographic python library with matplotlib support

Cartopy is a Python package designed to make drawing maps for data analysis and visualisation easy. Table of contents Overview Get in touch License an

null 1.2k Jan 1, 2023
Some examples with MatPlotLib library in Python

MatPlotLib Example Some examples with MatPlotLib library in Python Point: Run files only in project's directory About me Full name: Matin Ardestani Ag

Matin Ardestani 4 Mar 29, 2022