Skip to content
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

tooltip on y-axis looks wrong #393

Closed
alshan opened this issue Jun 12, 2021 · 9 comments
Closed

tooltip on y-axis looks wrong #393

alshan opened this issue Jun 12, 2021 · 9 comments
Assignees

Comments

@alshan
Copy link
Collaborator

alshan commented Jun 12, 2021

image

.. I'll add the code example later.

@alshan
Copy link
Collaborator Author

alshan commented Jun 12, 2021

In this notebook: COVID-19 in India: EDA and Spatial Visualization

@OLarionova-HORIS OLarionova-HORIS self-assigned this Jun 16, 2021
@OLarionova-HORIS
Copy link
Contributor

Could you please clarify what is the expected result? Should match the axis label?

@alshan alshan changed the title tooltip on x-axis looks wrong tooltip on y-axis looks wrong Jun 28, 2021
@alshan
Copy link
Collaborator Author

alshan commented Jun 28, 2021

I meant "y-axis", sorry. I was using:

scale_y_continuous(format="{} %")

and expected the value being formatted using default formatter. The only difference would be the added suffix: ' %'

@alshan alshan added this to the 2021Q3 milestone Jun 28, 2021
@alshan alshan modified the milestones: 2021Q3, 2021Q4 Sep 28, 2021
@alshan
Copy link
Collaborator Author

alshan commented Nov 1, 2021

When I try to fix tooltip formatting via layer_tooltips().format('@Y', '{.1f}%') , it has no effect.

If I format y-axis: scale_y_continuous(format="{.0f} %") , then the y-axis tooltip shows only integer part (expected to see tenths).

@OLarionova-HORIS
Copy link
Contributor

Now the tooltip format() does not apply to the axis tooltip. But should it be applied? Then the field='^y' will apply for y-axis tooltip and '^Y' - for all positional including y-axis.
And tenths will be displayed in the case of layer_tooltips().format('^y', '{.1f}%').

@alshan
Copy link
Collaborator Author

alshan commented Nov 5, 2021

I think yes, "^y" and "@y" should include "y" aesthetic no matter in which tooltip.

The 2nd part in this issue is that using scale_y_continuous(format="{} %") shouldn't change y-axis tooltip formatting.

@alshan
Copy link
Collaborator Author

alshan commented Nov 5, 2021

using scale_y_continuous(format="{} %") shouldn't change y-axis tooltip formatting.

Expected the same behavior as in this notebook: https://nbviewer.org/github/JetBrains/lets-plot-docs/blob/master/source/examples/cookbook/formatting_axes_etc.ipynb

See Out[6]

@OLarionova-HORIS
Copy link
Contributor

The first path of the issue - applying format() to the axis tooltip: #473

@OLarionova-HORIS
Copy link
Contributor

Add changes #483 - the scale format is applied to tick labels only.

The rules now are as follows:
- the scale's format parameter is applied to tick labels only and does not affect tooltips;
- the tooltip format() is also applied to the axis tooltip;
- if the tooltip format() is not specified, the tooltip will get the value after applying the default formatting from the scale (without using the specified format for the scale).

So the following settings
layer_tooltips().format("^Y", "{.1f} %") -- tooltip
+
scale_y_continuous(format="{} %") -- ticks
will give the result:

Screenshot 2021-11-25 at 19 22 23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants