6

I'm interested in creating a Shmoo-plot using LaTeX. I have looked through the PGFplot-examples but couldn't find any that looked suitable as a starting template. Google produces nothing as well, and I don't wish to abuse Excel for obvious non-pretty reasons (although it is very easy for this kind of plot).

If a Shmoo-plot is unfamiliar to you, it is a two dimensional (presented as such at least) discrete plot looking something like this:

enter image description here

What I want to produce like the image above, although without the pass/fail text. Do you have any suggestions on how I should approach the problem? Sorry if this is a very simple question, I am a beginner in PGFplots and might have missed an easy solution.

edit: this is a more accurate image of what I'm trying to reproduce. This is almost exactly the style I'm looking for.

enter image description here

the input data formatting can be changed to fit any solution, so it is not considered a problem. For example, it can be (x, y, p/f) such as a simple four point set:

(1, 10, 1) (1, 11, 0) (2, 10, 1) (2, 11, 0)

veor
  • 283
  • This could be something that can be easily coded for TikZ direct (e.g. a \matrix) or even a simple tabular. Especially if the x and y values are discrete like that. How does the input look like? – Qrrbrbirlbel Jul 02 '13 at 00:43
  • 3
    Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format – texenthusiast Jul 02 '13 at 00:54
  • I'm not familiar with a shmoo plot. But it looks straight-forward enough. Do you have sample data that would be the source for such a graph? – A.Ellett Jul 02 '13 at 01:10
  • If sample data is neccesary, it will be a three dimensional data set with an x-value, y-value and a discrete value (indicating pass/fail). A simple example with four points could look like: (1, 10, 1) (2, 10, 0) (1, 11, 1) (2, 11, 1). However, I can customize the formatting so not an issue. – veor Jul 02 '13 at 01:25
  • 1
    After reconsidering this might be something for the mesh or the surf plot, though it seems the colors of the z values are assigned to an area between coordinates and not an area around coordinates. – Qrrbrbirlbel Jul 02 '13 at 02:58
  • @Qrrbrbirbel: this might be a possible (although not very pretty solution. That each point would have to be extrapolated to four points to build a box, and then adjust the viewer to receive the 2-dimensional look. – veor Jul 02 '13 at 04:41
  • 1
    This could be a duplicate of http://tex.stackexchange.com/questions/73640/using-pgfplots-how-do-i-arrange-my-data-matrix-for-a-surface-plot-so-that-each – Christian Feuersänger Jul 02 '13 at 18:20
  • 1
    This could also be a duplicate of this question. – Tom Bombadil Jul 17 '13 at 13:01
  • This question might also be a starting point for a solution. – Count Zero Jul 22 '13 at 10:00

1 Answers1

3

Finally got a result I was satisfied with, and I'm answering this to help any other poor EE-engineer if they get stuck with the same thing. This is a simple solution compared to the ones discussed in the comments.

enter image description here

\documentclass{article}
\usepackage{pgfplots, amsmath}
\pgfplotsset{compat=newest}
\pgfplotsset{major grid style={color=black}, minor grid style={color=black}}
\pgfplotsset{every  tick/.style={black,}}


\pagestyle{empty}
\begin{document}
\begin{tikzpicture}
\begin{axis}[ 
 xmin=7.5,
 xmax=52.5,
 ymin=0,
 axis on top,
 tick align=outside,
 tickpos=left,
 xtick=data,
 minor xtick={7.5,12.5,...,55},
 ytick={0,0.2,...,2.5},
 minor ytick={0.1,0.2,...,2.4},
 enlargelimits=false,
 axis background/.style={fill=green!30},
 yminorgrids,
 ymajorgrids,
 xminorgrids,
 xlabel=Frequency (MHz),
 ylabel=V$_{\text{DD}}$ (V)]
\addplot
[const plot mark mid,fill=red!30] 
coordinates
{
(5,0.7)
(10,0.8)
(15,0.9)
(20,1)
(25,1.1)
(30,1.2)
(35,1.3)
(40,1.4)
(45,1.5)
(50,1.6) 
(55,1.7)
} 
\closedcycle;

\end{axis}
\end{tikzpicture}
\end{document}
veor
  • 283