#334 changing font color inside a string

closed-rejected
nobody
None
5
2012-07-04
2012-06-18
guu-sama
No

Dear developers,
it will very nice to manage styles (specially color) for plot-title in key for plot (may be, 3d splot aslo...). An example:
"plot sin(x) title "sin(x)" textcolor rgb "green", cos(x) title "cos(x) tc red"
If exec this "wrong" code with gnuplot, the title "sin(x)" in key box (or legend) will be green, while "cos(x)" -- red.
Thanks for your attention!
Sincerely urs.

Discussion

  • Ethan Merritt
    Ethan Merritt
    2012-06-18

    You can use the full "enhanced text" mode to specify plot titles in the key, including specifying different fonts or font sizes.

    To plot the key titles in color, use the command "set key textcolor variable". This will cause each plot title to be printed in the same color used for the plot itself.

     
  • guu-sama
    guu-sama
    2012-06-19

    Dear sfeam,
    yes, but line and title textcolor are the same. It will be greate if this color was different.
    For given example smth like that:
    plot sin(x) lc 1 title "sin(x)" textcolor 2,
    curve is red, title text is green.

     
  • Petr Mikulik
    Petr Mikulik
    2012-06-19

    You can cheat with colours in the key box this way:

    plot sin(x) notitle "sin(x)", 1/0 title "sin(x)", cos(x) notitle "cos(x)", 1/0 title "cos(x)" lt 1

     
  • Petr Mikulik
    Petr Mikulik
    2012-06-19

    • status: open --> pending-works-for-me
     
  • guu-sama
    guu-sama
    2012-06-19

    custom title tc in key

     
    Attachments
  • guu-sama
    guu-sama
    2012-06-19

    unfortunately, it cannot be a solution. The reason is: in given key box title's color and line's color is always the same. In my case in key box (so called legend) text color must be different from color of line. It is clear, that color of line in key box must be the same to color of curve, that corresponds to title. Please, see attached file.

     
  • Petr Mikulik
    Petr Mikulik
    2012-06-20

    Hm, mixing of arbitrary colours is not possible. (But I wonder about reason why to use your example it in real life.)

     
  • Petr Mikulik
    Petr Mikulik
    2012-06-20

    • status: pending-works-for-me --> pending
     
  • guu-sama
    guu-sama
    2012-06-20

    Dear mikulik,
    i've been waiting for this question :)
    My dream is to view waveforms from files, generated by oscilloscope. Of course i cannot bring such device from lab to home, only files i can get there... And ones more, for many reason the soft for such file reading is very unconvinient (cannot be saved in eps, fixed styles, no data proc and so on).
    For me this feature is needed to show active channel for manipulation (change Y-scale by specified key press). Now i just set label "Active channel is: 2", that is not convinient, i think...
    But may be you're right, this feature is not so critical.

     
  • Ethan Merritt
    Ethan Merritt
    2012-07-04

    • summary: Given font format for given plot-title in legend --> changing font color inside a string
    • status: pending --> closed-rejected