Giter Club home page Giter Club logo

Comments (4)

marcharper avatar marcharper commented on July 18, 2024

Yes, this is known (#44).

from python-ternary.

RihuiAn avatar RihuiAn commented on July 18, 2024

So, do you have any good solutions?

I don't know how to fix it by slightly moving the lines outward by the line-width.

from python-ternary.

marcharper avatar marcharper commented on July 18, 2024

Can you post the code that generated the plot?

from python-ternary.

RihuiAn avatar RihuiAn commented on July 18, 2024

def Color_point(x, z, y, 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):
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

offset, r, s = 0.3, 0.02, 100
x, y = (np.sqrt(3) + 1) * r, -2 * r
ct, cd, cq, c = 'r', 'y', 'b', '#f0f0f0'
fig, tax = ternary.figure(scale=s)
data = Generate_heatmap_data(scale=100)
tax.heatmap(data, style='dual-triangular', use_rgba=True, colorbar=False)
tax.boundary(linewidth=2, zorder=3)
tax.set_background_color(color=c, alpha=0.2)
tax.gridlines(multiple=20, linewidth=1, alpha=1,
horizontal_kwargs={'color': cd},
left_kwargs={'color': ct},
right_kwargs={'color': cq})
tax.top_corner_label('Dependence', fontweight='bold', position=(0 - 0.06 - x, 1 + 0.12 + 2 * x, 0), rotation=0,
color=cd)
tax.left_corner_label('Low streamflow', fontweight='bold', position=(0 - 0.05 - x, 0 + 0.05 + y, 0), rotation=-45,
color=cq)
tax.right_corner_label('High temperature', fontweight='bold', position=(1 + x, 0 + 0.05 + y, 0), rotation=45, color=ct)
tax.right_axis_label('Relative $R_D$', offset=offset, color=cd)
tax.left_axis_label('Relative $R_{LQ}$', offset=offset, color=cq)
tax.bottom_axis_label('Relative $R_{HT}$', offset=offset, color=ct)
tax.ticks(axis='lbr', multiple=20, linewidth=1.5, offset=0.025)
tax.get_axes().axis('off')
tax.clear_matplotlib_ticks()
fig.set_facecolor('#f0f0f0')
tax.show()

from python-ternary.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.