Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. documentclass{standalone}
  2. usepackage{pgfplots}
  3.  
  4. begin{document}
  5.  
  6. begin{tikzpicture}
  7. begin{axis}[colorbar, colormap={}{ gray(0cm)=(1); gray(1cm)=(0);}]
  8. addplot[mesh,thick] {x^2};
  9. end{axis}
  10. end{tikzpicture}
  11.  
  12. begin{tikzpicture}
  13. begin{axis}[colorbar, colormap={}{ gray(0cm)=(0); gray(1cm)=(1);}]
  14. addplot[mesh,thick] {x^2};
  15. end{axis}
  16. end{tikzpicture}
  17.  
  18. end{document}
  19.  
  20. documentclass{standalone}
  21. usepackage{pgfplots}
  22. usepgfplotslibrary{colormaps}
  23.  
  24. begin{document}
  25.  
  26. pgfplotsset{
  27. %colormap={X}{ gray(0cm)=(1); gray(1cm)=(0);},
  28. colormap/winter,
  29. }
  30. begin{tikzpicture}
  31. begin{axis}[colorbar]
  32. addplot[mesh,thick] {x^2};
  33. end{axis}
  34. end{tikzpicture}
  35.  
  36. begin{tikzpicture}
  37. begin{axis}[colorbar,
  38. colormap={reverse winter}{
  39. indices of colormap={
  40. pgfplotscolormaplastindexof{winter},...,0 of winter}
  41. },
  42. ]
  43. addplot[mesh,thick] {x^2};
  44. end{axis}
  45. end{tikzpicture}
  46.  
  47. end{document}
  48.  
  49. documentclass{standalone}
  50. usepackage{pgfplots}
  51. usepgfplotslibrary{colormaps}
  52.  
  53. makeatletter
  54. defcustomrevertcolormap#1{%
  55. pgfplotsarraycopy{pgfpl@cm@#1}to{custom@COPY}%
  56. c@pgf@counta=0
  57. c@pgf@countb=pgfplotsarraysizeof{custom@COPY}relax
  58. c@pgf@countd=c@pgf@countb
  59. advancec@pgf@countd by-1 %
  60. pgfutil@loop
  61. ifnumc@pgf@counta<c@pgf@countb
  62. pgfplotsarrayselect{c@pgf@counta}of{custom@COPY}topgfplots@loc@TMPa
  63. pgfplotsarrayletentryc@pgf@countdof{pgfpl@cm@#1}=pgfplots@loc@TMPa
  64. advancec@pgf@counta by1 %
  65. advancec@pgf@countd by-1 %
  66. pgfutil@repeat
  67. %pgfplots@colormap@showdebuginfofor{#1}%
  68. }%
  69.  
  70. makeatother
  71.  
  72. begin{document}
  73.  
  74. pgfplotsset{
  75. %colormap={X}{ gray(0cm)=(1); gray(1cm)=(0);},
  76. colormap/winter,
  77. }
  78. begin{tikzpicture}
  79. begin{axis}[colorbar]
  80. addplot[mesh,thick] {x^2};
  81. end{axis}
  82. end{tikzpicture}
  83.  
  84. begin{tikzpicture}
  85. %customrevertcolormap{X}
  86. %customrevertcolormap{jet}
  87. customrevertcolormap{winter}
  88. begin{axis}[colorbar]
  89. addplot[mesh,thick] {x^2};
  90. end{axis}
  91. end{tikzpicture}
  92.  
  93. end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement