You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Great tool for making ternary plots! It'd be great for visualisation of any trends if the points within a given tax.scatter(...) line could be given more than one colour to allow for datasets to be coloured by something else (another variable in the dataset for example). E.G after a Pandas import of...:
Name Depth V1 V2 V3
0 Unit1 14 10 20 70
1 Unit2 15 50 50 0
2 Unit3 16 25 20 5
3 Unit4 18 50 25 25
Could be plotted according to V1,V2,V3 proportions and coloured by either Name (i.e grouping into identical groups) or according some other parameter (e.g Depth).
To do this at the moment would require lots of individual tax.scatters which is great if you want the flexibility of changing shape etc but can be cumbersome with larger datasets. Apologies if this is already there or a other simple solution - only a couple of weeks into my Python life!
Cheers,
Tim
The text was updated successfully, but these errors were encountered:
Hi, thanks for the suggestion. I've considered supporting dataframes, the main reason that the library currently does not support them is simply because most of it was written before pandas became common.
It should not be hard to write a function to handle this behavior in the meantime, something like:
Hi Marc,
Thanks very much for getting back to me so quickly and the explanation and
solution! Also discovered in the many **kwargs for tax.scatter that c= (and
appropriate colour map etc) also works. However the flexibility of the
function is great.
All the best,
Tim
On Wed, 24 Jul 2019 at 03:32, Marc ***@***.***> wrote:
Hi, thanks for the suggestion. I've considered supporting dataframes, the
main reason that the library currently does not support them is simply
because most of it was written before pandas became common.
It should not be hard to write a function to handle this behavior in the
meantime, something like:
def dataframe_to_scatter(df, xcol, ycol, zcol, colorcol):
fig, tax = ternary.figure()
colors = list(sorted(set(df[colorcol].tolist())))
for color in colors:
subdf = df[df[colorcol] == color]
xs = subdf[xcol].tolist()
ys = subdf[ycol].tolist()
zs = subdf[zcol].tolist()
tax.scatter(zip(xs, ys, zs), color=color)
return tax
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#109?email_source=notifications&email_token=AICTPEYDVHB42SLTOCVAFLTQA65NVA5CNFSM4IGJVKHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2U7LEQ#issuecomment-514454930>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AICTPEYTSLRA7Z5ERPE7SZLQA65NVANCNFSM4IGJVKHA>
.
Hi,
Great tool for making ternary plots! It'd be great for visualisation of any trends if the points within a given tax.scatter(...) line could be given more than one colour to allow for datasets to be coloured by something else (another variable in the dataset for example). E.G after a Pandas import of...:
Name Depth V1 V2 V3
0 Unit1 14 10 20 70
1 Unit2 15 50 50 0
2 Unit3 16 25 20 5
3 Unit4 18 50 25 25
Could be plotted according to V1,V2,V3 proportions and coloured by either Name (i.e grouping into identical groups) or according some other parameter (e.g Depth).
To do this at the moment would require lots of individual tax.scatters which is great if you want the flexibility of changing shape etc but can be cumbersome with larger datasets. Apologies if this is already there or a other simple solution - only a couple of weeks into my Python life!
Cheers,
Tim
The text was updated successfully, but these errors were encountered: