Loading ...
Sorry, an error occurred while loading the content.

2302Re: [ploticus] proc legend title interaction with outlinecolors?

Expand Messages
  • Steve Grubb
    Mar 18, 2011
    • 0 Attachment
      Hello Dan,

      This glitch can be fixed by modifying proc_legend.c by adding a PLG_forcecolorchg() statement as shown here:

      /* draw swatch(es), depending on type */
              if( LEtype[j] == LEGEND_COLOR ) {
                      sampwidth = swatchsize+0.1;
                      if( format == ACROSS && x > startx ) x += sampwidth;
                      sscanf( &Ltext[LEparm1[j]], "%s", color );
                      if( strcmp( color, backcolor ) ==0 ) outline = 1;
                      else outline = do_outline;
                      if( outline ) { Elinetype( 0, 0.5, 1.0 ); Ecolor( Estandard_color ); PLG_forcecolorchg(); }
                      Ecblock( x-(swatchsize+0.1), y, x-0.1, y+swatchsize, color, outline );
                      }


      When I tested it all legend color samples were outlined when running your 2nd example.  Modify proc_legend.c as shown, do a make clean; make pl

      Thanks for finding this problem,

      Steve


      On Fri, Mar 18, 2011 at 10:18 AM, Steve Grubb <stevegrubb@...> wrote:
      Hello Dan,

      I am able to reproduce the problem here. Seems like a bug. At one point a couple of years ago an optimization was contributed that rightly cut way down on the number of unnecessary output device color change requests, but also led to occasional glitches like this.

      I will check into it further and try to offer a fix or at least a workaround.  Thanks for making it easy for me to get started on the issue by including basic self-contained scripts that reproduce the problem.

      Steve



      On Sat, Mar 5, 2011 at 2:54 AM, Daniel <dagoldman@...> wrote:
       

      Script TITLE-N works like I expect.
      The boxes in the legend are outlined.

      In Script TITLE-Y, I add title in proc legend.
      Otherwise, the script is identical.
      Now, the first box in the legend is not outlined.

      I've done tests with more boxes in legend.
      It's always just the first box not outlined.

      What am I doing wrong? Any suggestions?

      ploticus 2.41-Mar2009 (unix). This build can produce: PS EPS SVG SVGZ X11 PNG JPEG WBMP FreeType2

      Thanks,
      Daniel

      ********** Script TITLE-N works like I expect.

      #proc settings
      xml_encoding: utf-8
      units: cm

      #proc page
      font: VeraMono
      crop: 0 0 15.2500 6.2200
      textsize: 10

      backgroundcolor: xFFFFE0

      #proc getdata
      data:
      0.0000 "0-9" 1.000000 0.000000
      1.2000 "10-19" 33246.000000 31688.000000
      2.4000 "20-29" 164630.000000 157807.000000
      3.6000 "30-39" 88303.000000 84147.000000
      4.8000 "40-49" 4553.000000 4354.000000
      6.0000 "50-59" 9.000000 11.000000
      7.2000 "60-99+" 0.000000 0.000000
      8.4000 "Unk" 307.000000 252.000000

      #proc categories
      axis: x
      datafield: 1

      #proc areadef
      location: 2.0900 1.5000
      box: 10.8000 4.0000
      yscaletype: linear
      xscaletype: categories
      xrange: categories
      yrange: 0 164630.000000

      #proc xaxis
      tics: yes
      selflocatingstubs: datafields=1,2
      label: Age of Mom
      ticlen: 0.0500
      labeldistance: 0.7800

      #proc yaxis
      stubs: inc
      stubcull: 0.3600
      stubformat: %.0f
      label: Births
      ticlen: 0.0500
      grid: color=gray(0.6) style=1 dashscale=1.0 width=0.1
      labeldistance: 1.5700

      #proc bars
      hidezerobars: no
      locfield: 1
      outline: color=black width=0.1000
      lenfield: 3
      cluster: 1 / 2
      barwidth: 0.4
      legendlabel: Boy
      color: rgb(0.930,0.387,0.387)

      #proc bars
      hidezerobars: no
      locfield: 1
      outline: color=black width=0.1000
      lenfield: 4
      cluster: 2 / 2
      barwidth: 0.4
      legendlabel: Girl
      color: rgb(0.234,0.699,0.441)

      #proc legend
      colortext: no
      outlinecolors: yes
      format: multiline
      swatchsize: 0.3600
      location: 13.9700 5.1400
      separation: 0.0000

      #proc annotate
      outline: no
      textdetails: align=L size=8
      location: 0.1600 0.1600
      text: 304GXPQZ-1

      ******* TITLE-Y loses outline for first legend box.

      #proc settings
      xml_encoding: utf-8
      units: cm

      #proc page
      font: VeraMono
      crop: 0 0 15.2500 6.2200
      textsize: 10

      backgroundcolor: xFFFFE0

      #proc getdata
      data:
      0.0000 "0-9" 1.000000 0.000000
      1.2000 "10-19" 33246.000000 31688.000000
      2.4000 "20-29" 164630.000000 157807.000000
      3.6000 "30-39" 88303.000000 84147.000000
      4.8000 "40-49" 4553.000000 4354.000000
      6.0000 "50-59" 9.000000 11.000000
      7.2000 "60-99+" 0.000000 0.000000
      8.4000 "Unk" 307.000000 252.000000

      #proc categories
      axis: x
      datafield: 1

      #proc areadef
      location: 2.0900 1.5000
      box: 10.8000 4.0000
      yscaletype: linear
      xscaletype: categories
      xrange: categories
      yrange: 0 164630.000000

      #proc xaxis
      tics: yes
      selflocatingstubs: datafields=1,2
      label: Age of Mom
      ticlen: 0.0500
      labeldistance: 0.7800

      #proc yaxis
      stubs: inc
      stubcull: 0.3600
      stubformat: %.0f
      label: Births
      ticlen: 0.0500
      grid: color=gray(0.6) style=1 dashscale=1.0 width=0.1
      labeldistance: 1.5700

      #proc bars
      hidezerobars: no
      locfield: 1
      outline: color=black width=0.1000
      lenfield: 3
      cluster: 1 / 2
      barwidth: 0.4
      legendlabel: Boy
      color: rgb(0.930,0.387,0.387)

      #proc bars
      hidezerobars: no
      locfield: 1
      outline: color=black width=0.1000
      lenfield: 4
      cluster: 2 / 2
      barwidth: 0.4
      legendlabel: Girl
      color: rgb(0.234,0.699,0.441)

      #proc legend
      colortext: no
      outlinecolors: yes
      format: multiline
      swatchsize: 0.3600
      location: 13.9700 5.1400
      separation: 0.0000
      title: Sex

      #proc annotate
      outline: no
      textdetails: align=L size=8
      location: 0.1600 0.1600
      text: 304PGEKB-1

      ******* diff title-y.txt title-n.txt

      78d77
      < title: Sex
      84c83
      < text: 304PGEKB-1
      ---
      > text: 304GXPQZ-1



    • Show all 4 messages in this topic