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

Baselines for ENH: Add vector legend. #169

Merged
merged 4 commits into from
May 2, 2017
Merged

Baselines for ENH: Add vector legend. #169

merged 4 commits into from
May 2, 2017

Conversation

danlipsa
Copy link
Contributor

@danlipsa danlipsa commented May 1, 2017

No description provided.

@danlipsa
Copy link
Contributor Author

danlipsa commented May 1, 2017

@doutriaux1 Also take a look that the changed baselines and how the vector legend looks like. Note that for linear mapping we have two vectors in the legend for other scaling options only one vector is sufficient.

@doutriaux1
Copy link
Contributor

@danlipsa I think we shouldn't draw the legend's box.
Also, and it's a minor point, feel free to left unchanged, historically I think the arrow was left-aligned with the legend box, not centered.
I can't decide if your way (centered) is better or not.

@danlipsa
Copy link
Contributor Author

danlipsa commented May 2, 2017

I think we shouldn't draw the legend's box.

I used drawLinesAndMarkersLegend as a starting point, and that function draws a box - this way it is consistent. Thinking about this, I kind of like the box with an arrow inside, instead of just an arrow floating without any context.

Also, and it's a minor point, feel free to left unchanged, historically I think the arrow was left-aligned with > the legend box, not centered.
I can't decide if your way (centered) is better or not.

Note that you can also have two arrows which are drawn at 1/3 and 2/3, so I think centered fits well with this.

If you feel strongly we should change these we can get @aashish24 opinion as well. However, he might prefer something different than both of us and then we are stuck 😄

@aashish24
Copy link
Contributor

I used drawLinesAndMarkersLegend as a starting point, and that function draws a box - this way it is consistent. Thinking about this, I kind of like the box with an arrow inside, instead of just an arrow floating without any context.

can we make it optional with default to no-box?

@aashish24
Copy link
Contributor

Note that you can also have two arrows which are drawn at 1/3 and 2/3, so I think centered fits well with this.

I like the center since there it is noticeable. If it is left aligned, i would have missed it. My vote is for center

@danlipsa
Copy link
Contributor Author

danlipsa commented May 2, 2017

@doutriaux1 @aashish24 I can just delete the box then.

@jypeter
Copy link
Member

jypeter commented May 2, 2017

No box by default as before can be useful, in case you already have a boxfill/isofill or some other gm legend, and you need to find some space to put all this on the canvas

btw, what happens if your template.legend box is higher than it is wide. Do you get a vertical arrow? Though I think a vertical arrow may look strange...

@doutriaux1
Copy link
Contributor

@danlipsa i don't feel strongly about this. But as @jypeter mentioned it's easy enough to add a box, whereas we can't remove yours, so I'd vote for no box by default. I think isolines draw the lines left aligned, so maybe just for consistency we could have it left aligned.

@danlipsa
Copy link
Contributor Author

danlipsa commented May 2, 2017

@jypeter For now, I only have the horizontal layout. @doutriaux1 Do we have vertical layouts for other legends (color bar, line plots)?

@doutriaux1 OK, I'll remove the box. Should I still keep it as an option, or completely remove it?
Can you point me to some examples with an isoline legend?

@danlipsa
Copy link
Contributor Author

danlipsa commented May 2, 2017

@doutriaux1
Copy link
Contributor

yes completely remove it.

@doutriaux1
Copy link
Contributor

@danlipsa I see that isoline does not draw a legend anymore... I'll dig the old vcs

@doutriaux1
Copy link
Contributor

crppy

@doutriaux1
Copy link
Contributor

@danlipsa @aashish24 this is the same plot in the latest vcs
crp

@doutriaux1
Copy link
Contributor

@aashish24 it is not even close in quality 😿

@doutriaux1
Copy link
Contributor

@aashish24 @danlipsa latest png generate on mac/mesa with default settings

@doutriaux1
Copy link
Contributor

@danlipsa let's not worry about the legend as long as you removed the box. I need to get this release out!

@danlipsa
Copy link
Contributor Author

danlipsa commented May 2, 2017

@doutriaux1 Sounds good. I'll just remove the box and leave everything else as is.

@danlipsa
Copy link
Contributor Author

danlipsa commented May 2, 2017

@doutriaux1 @aashish24 Updating baselines is such a pain with the new testing framework =

while (forever)
     run test script
     update one baseline

Compare this with before =

  1. run tests.
  2. review all baselines that changed
  3. update all baselines that changed

We should really fix this:
CDAT/vcs#160

@aashish24
Copy link
Contributor

@aashish24 it is not even close in quality

this is the comparison with vector graphics and raster graphics. A fair comparison would be if you export both as vector format 😄. The underlying technology has its up and downs. Vector looks better by default because you get infinite resolution, raster is faster and hardware accelerated. If you export both as PDF they should look the same.

@aashish24
Copy link
Contributor

@doutriaux1 Sounds good. I'll just remove the box and leave everything else as is.

+1, I like the legend at the center since it is only one arrow but I think that should be a user option since this is really a matter of choice, nothing is right or wrong.

@aashish24
Copy link
Contributor

aashish24 commented May 2, 2017

@danlipsa let's not worry about the legend as long as you removed the box. I need to get this release out!

@doutriaux1 I thought we may not get the legend in the release as discussed over the phone call. I guess since we got extra time now, are we planning to have it in the release? If that is the case @danlipsa you may want to add a notebook example after the branch is merged.

@doutriaux1
Copy link
Contributor

@danlipsa there is an update keyword now in the checkImage code, so if you know what you're doing you can force update all the blines.

@doutriaux1
Copy link
Contributor

@aashish24 this is a fair comparison, they're both pngs.

@aashish24
Copy link
Contributor

@aashish24 this is a fair comparison, they're both pngs.

@doutriaux1 yes they both are png's but one came from vector graphics and other from raster graphics (http://vector-conversions.com/vectorizing/raster_vs_vector.html). The output from vector graphics to png will have aliasing applied and that's why you do not see the sharp lines but rather a smooth looking plot. If you want to do the same, then enable the aliasing and it should get better. By default we turn off aliasing.

@danlipsa
Copy link
Contributor Author

danlipsa commented May 2, 2017

@doutriaux1 @aashish24 I agree the old vcs looks better. Things we can do:

We can file an issue and fix this.

@aashish24
Copy link
Contributor

aashish24 commented May 2, 2017

+1 for what @danlipsa said. I also notes some other differences in defaults.

I think it makes sense to turn off aliasing for testing but we should have anti-aliasing on as default and that will ensure that our plots by default are pretty as @doutriaux1 noted

@doutriaux1 doutriaux1 merged commit 36944ef into master May 2, 2017
@doutriaux1 doutriaux1 deleted the vector-legend branch May 2, 2017 22:17
@doutriaux1
Copy link
Contributor

@aashish24 FYI antialiasing was return 8 I'm not sure why pngs are not antialiased any longer?

@danlipsa
Copy link
Contributor Author

danlipsa commented May 4, 2017

@sankhesh This is the anti-aliasing issue @doutriaux1 mentioned.

@sankhesh
Copy link
Contributor

sankhesh commented May 4, 2017

@doutriaux1 I think you see differences because of isoline linewidth. See the images below:

linewidth = 0.5 linewidth = 1.0
isoline_width_0 5 isoline_width_1 0

@jypeter
Copy link
Member

jypeter commented May 5, 2017

I'm sorry my comment has nothing to do with vector legend, but do you have anti-aliasing or not in the 2 figures above? And is it for the whole plot or just the data part (in this case the plotted isolines and continents)?

Because when I look at the text, even with the sun shining on my screen, I get the impression that is slightly different in both figures, ie the text on the 0.5 figure looks more anti-aliased than the text on the 1.0 figure

Is anti-aliasing something that can be selected by the user? I totally agree that it should be 'on' by default and I understand that it's probably better to have it 'off' for testing purpose if you need to compare images. What is the anti-aliasing setting for 2.8.0?

@sankhesh
Copy link
Contributor

sankhesh commented May 5, 2017

I'm sorry my comment has nothing to do with vector legend, but do you have anti-aliasing or not in the 2 figures above? And is it for the whole plot or just the data part (in this case the plotted isolines and continents)?

Yes, antialiasing is enabled for both the plots and is set to 8 MSAA samples for the whole plot.

What is the anti-aliasing setting for 2.8.0?

It is 8 samples by default:

https://github.com/UV-CDAT/vcs/blob/8293dd09eb798952da87cce4bce993a3ba6d8d3e/vcs/VTKPlots.py#L74

You can set it on the canvas as follows:

import vcs
x = vcs.init()
x.setantialiasing(8)  # 8 MSAA samples
# x.setantialiasing(0)  # disable antialiasing

@aashish24
Copy link
Contributor

Because when I look at the text, even with the sun shining on my screen, I get the impression that is slightly different in both figures, ie the text on the 0.5 figure looks more anti-aliased than the text on the 1.0 figure

@jypeter I agree with you. On the text I do see some difference in anti-aliasing for text which is sometwhat bit surprising. We will have a look at it. @sankhesh can you run your test again and post your images again? Make sure that the plots of same size and so is the PNG. Can you post it sometime soon? Also perhaps we should create an issue in VCS and follow up conversation there.

@doutriaux1 is it possible that you captured the last image from testing which sets the anti-aliasing to 0?

@sankhesh
Copy link
Contributor

sankhesh commented May 6, 2017

@aashish24 @doutriaux1 @jypeter @danlipsa Please continue the discussion at CDAT/vcs#190

@doutriaux1
Copy link
Contributor

@aashish24 nope did it from the command line and checked that antialiasing was 8

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

Successfully merging this pull request may close these issues.

5 participants