-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Manually Change min and max Value #18
Comments
Hi, that's true. It's not currently possible to assign a min value. I'll work on this ASAP. |
Amazing! If you want I could also take a look. Sounds like a good first issue to solve :) |
Hi Bruno, great package; as soon as I saw it I thought it would be great for visualising the return on public transport usage for my dissertation. However, a lot of the data I'm looking at has movement from a zero baseline either in the positive and negative direction. As Sören pointed out, it would be great to be able to visualise -ve to +ve values or set the min and max range. Looking forward to the update! Chris |
Hi @soerenetler and @OmniaData , I'll be adding this feature in the next release. I'd be happy to hear some opinions. import numpy as np
import pandas as pd
from plotly_calplot.calplot import calplot, month_calplot
# mock setup
dummy_start_date = "2019-01-01"
dummy_end_date = "2022-10-03"
dummy_df = pd.DataFrame(
{
"ds": pd.date_range(dummy_start_date, dummy_end_date),
"value": np.random.randint(
0,
30,
(pd.to_datetime(dummy_end_date) - pd.to_datetime(dummy_start_date)).days
+ 1,
),
}
)
fig1 = calplot(
dummy_df,
x="ds",
y="value",
showscale=True,
cmap_max=20,
cmap_min=10
) fig1 = calplot(
dummy_df,
x="ds",
y="value",
showscale=True,
cmap_max=50
) fig1 = calplot(
dummy_df,
x="ds",
y="value",
showscale=True,
cmap_max=25,
cmap_min=-10,
colorscale="rdylgn"
) |
That's fantastic, Bruno. Looking forward to it! I do prefer manually setting min and max values; however, for end-user experience, I would suggest the option to auto scale min and max based on the dataframe values. I've also been using arcGIS the last few days. A cool feature they have on mapping colours is the ability to choose from natural breaks (Jenks), equal interval, and quantiles. Additionally, you are able to select the number of classes (last image) that the colour steps are broken in to. No pressure to add it as a feature, but it may be something that you'd like to check out for the future. If you are interested, more information can be found here: |
@OmniaData that's awesome. I've been looking for something like the natural breaks algorithm for a while, just didn't know how to phrase it correctly. I should've been clearer, I've added auto scaling by default based on the dataframe min and max values and added the |
I'll leave this issue open so these references won't get lost. |
Hello again,
When using calplot I notice that the min value of the heatmap is fixed to 0 und the max value is fixed to the highest datapoint in the column. It would be great to manually change these values to e.e. allow for negative number and change the maximum value e.g. from 980 in the dataset to 1000 to make the scale easier to understand.
This is currently not possible or did I miss anything.
thank you for your work again and all the best,
Sören
The text was updated successfully, but these errors were encountered: