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

Several marker problems/differences in 2.1.0 (compared to 1.5.1) #95

Closed
chaosphere2112 opened this issue Nov 23, 2016 · 1 comment
Closed
Labels
Milestone

Comments

@chaosphere2112
Copy link
Contributor

I have used test script listed at the end of this issue to test markers in 2.1.0 and see how they differ from 1.5.1. I have found several problems and differences, but @chaosphere2112 can probably use this script in the gallery once the problems are solved

I originally wanted to experiment with projections to see if #672 had been solved but I have found other problems and probably won't have time to experiment with non default projection. My ultimate goal and need is of course to be able to overlay data points markers over a vcs map, whatever the projection is!

png created with 2.1.0
test_simple_marker-2 1 0

png created with 1.5.1
test_simple_marker-1 5 1

The problems and differences:

  • The markers are smaller in 2.1.0 and 1.5.1 . You probably want to check the scale to make sure to get the same size, but being able to get smaller markers than 1.5.1 is a good thing! So I hope we can use non integer marker sizes to be able to get lots of different marker sizes
  • At least one marker from 1.5.1 is missing from 2.1.0 and I get the following warning. You can also see the result on the plots above
/home/share/unix_files/cdat/versions/cdat_install_uv-2.1.0_x86_64_gcc4_13/lib/python2.7/site-packages/vcs/vcs2vtk.py:1113: UserWarning: unknown marker type: star, using dot
  warnings.warn("unknown marker type: %s, using dot" % t)
  • Non filled markers in 1.5.1 are filled in 2.1.0! See the plots above: eg triangle_up is the same as triangle_up_fill
  • There is a nice improvement I should mention! The markers are much nicer in the 2.1.0 pdf than in 1.5.1! But there is room for improvement. As you can see in the 300% magnified pdf screenshot below, with 1.5.1 on the left and 2.1.0 on the right, the dot and circle markers are much nicer in 2.1.0, but they should be described/rendered with a circle primitive (filled or empty) rather than with a list of segments
    magnified_pdf_vcs_markers
  • When you look at the magnified pdf above, you see that the markers and text that have the same y coordinate have their center vertically aligned in 1.5.1, but not in 2.1.0. The vertical alignment seems better in the png files, but it's harder to tell. You would have to generate a higher resolution png

The test script:

#!/usr/bin/env python

# A simple vcs markers test/demo
#
# J-Y Peterschmitt - LSCE - 02/2015

import numpy as np, vcs

x = vcs.init()

# Create a first group of markers: a vertical line of 3 green
# triangles, a diagonal of orange diamonds and a diagonal of black
# disks
#
# Everything will be plotted in the 0.05 to 0.95 part of the canvas
# horizontally, and from 0.1 to 0.9 vertically (aka, the "viewport")
#
# The coordinates of the markers inside the viewport will be from 0 to
#100 (aka the "world coordinates")
marker_test = x.createmarker('marker_test')
marker_test.worldcoordinate = [0, 100, 0, 100]
marker_test.viewport = [0.05, 0.95, 0.1, 0.9]
marker_test.x = [[90, 90, 90],
                 [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100],
                 [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]]
marker_test.y = [[25, 50, 75],
                 [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100],
                 [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0]]
marker_test.type = ['triangle_down_fill',
                    'diamond_fill',
                    'dot']
marker_test.size = [20.,
                    20.,
                    15.]
marker_test.color = [243, # Green
                     248, # Orange
                     241] # Black

# Create a second group of markers, all red and of the same size,
# using the same viewport and world coordinates as marker_test
some_markers = ['dot', 'plus', 'star', 'circle', 'cross',
                'diamond', 'triangle_up', 'triangle_down',
                'triangle_down', 'triangle_left', 'triangle_right',
                'square', 'diamond_fill', 'triangle_up_fill',
                'triangle_down_fill', 'triangle_left_fill',
                'triangle_right_fill', 'square_fill']

x_mrk = 5
x_mrk_step = 40
y_mrk0 = 95
y_mrk = y_mrk0
y_mrk_step = 10
x_list = []
y_list = []
x_list_text = []
y_list_text = []
for mrk in some_markers:
    x_list.append([x_mrk])
    x_list_text.append(x_mrk + 5)
    y_list.append([y_mrk])
    y_list_text.append(y_mrk)

    # Determine the location of the next marker
    y_mrk -= y_mrk_step # y_list = y_list - y_mrk_step
    if y_mrk < 15:
        # Start a new column!
        x_mrk += x_mrk_step
        y_mrk = y_mrk0

marker_demo = x.createmarker('marker_demo')
marker_demo.worldcoordinate = marker_test.worldcoordinate
marker_demo.viewport = marker_test.viewport
marker_demo.x = x_list
marker_demo.y = y_list
marker_demo.type = some_markers
nb_markers = len(some_markers)
marker_demo.size = nb_markers * [15] # All the markers are of size 15
marker_demo.color = nb_markers * [242] # All the markers are red

# Plot the marker names next to the markers, using the same viewport
# and world coordinates as marker_demo (and marker_test)
marker_names = x.createtext('marker_names')
marker_names.worldcoordinate = marker_test.worldcoordinate
marker_names.viewport = marker_test.viewport
marker_names.x = x_list_text
marker_names.y = y_list_text
marker_names.string = some_markers
marker_names.color = 241

# Plot everything
x.plot(marker_test)
x.plot(marker_demo)
x.plot(marker_names)

# Save the plot to a png file
x.png('test_simple_marker', draw_white_background=True)
x.pdf('test_simple_marker')

# The end

Migrated from: CDAT/cdat#1079

@doutriaux1 doutriaux1 modified the milestone: 3.0 May 5, 2017
@doutriaux1 doutriaux1 modified the milestones: 3.0, post 3.0 Mar 29, 2018
@doutriaux1 doutriaux1 modified the milestones: 8.1, 8.2 Mar 27, 2019
@doutriaux1
Copy link
Contributor

marker sizes changed again, but it was agreed upon. closing snceI don't think the issue is relevant anymore

@downiec downiec modified the milestones: 8.2, 8.2.1 Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants