Graph plot colour dependent on x axis

Dear Labview forum,
I would like to plot a graph in which the plot colour is dependent on the x axis value.
Eg I have a power vs frequency graph and would like the plot colour to
be say green for a certain frequency range, yellow for another range,
and the remaining range can stay white.
Is this possible? How so?
Thanks for your consideration,
Jamie
Using Labview version 8.0

If it is just a few colors, plot your data several times while editing each data part in such a way that the undesired colors contain NaN instead of data for each X.
(If you want contiunously variable shades of colors, make your own graph using a picture indicator. )
A simple example from long time ago can be found here: http://forums.ni.com/ni/board/message?board.id=170&message.id=65314#M65314, just modify for your purpose.
Message Edited by altenbach on 01-06-2007 09:37 AM
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • XY graph plot colour

    Hi All,
    I have a problem with the XY Graph representation.
    I'm trying to show different plot with different colours in the same graph.
    I realized a VI (8.2 Labview version), but it is wrong because at every iteration all the trace are re-colored with the same
    colour.
    I have two 1D array (X array and Y array) and my goal is to show every (X,Y) point with different colours.
    Could please someone help me?
    I attached the VI and a Front Panel screenshot.
    Thanks in advance for your support,
    Francesco.
    Attachments:
    XYGraph&Color.vi ‏47 KB
    XYGraphColorFrontPanel.JPG ‏164 KB

    Please take a look at this. Hope it helps.
    Message Edited by NitinD on 28-08-2009 07:04 PM
    Attachments:
    XYGraph&Color.vi ‏21 KB
    xygraph.jpg ‏102 KB

  • Plot a 2D Graph as Date being on X-Axis

    hi all,
    I'm a quite a new bee to Java 2D an would like to know if there are any possibilities to plot a graph in java 2D with X Axis representing Date.
    I would need a graph somewhat like
    Y
    |_____
    | _______
    |
    |_____
    |
    |________________________ X Axis = Date ->
    I have to plot a graph which has a Blocks (consisting of Start & end Dates).
    So my graph looks like as shown above and starting point of my graph being the start date of Block & End point being End Date respectively.
    Any help in this regard will be highly appreciable.
    Thanx
    Ati

    import java.awt.*;
    import java.awt.font.*;
    import java.awt.geom.*;
    import java.text.*;
    import java.util.*;
    import javax.swing.*;
    public class PlottingData extends JPanel {
        int[] xVals;
        int[] yVals;
        final int MIN = 50;
        final int MAX = 100;
        final int PAD = 25;
        public PlottingData() {
            // Create a couple of "dates".
            Calendar start = Calendar.getInstance();
            start.setTime(new Date());
            Calendar end = Calendar.getInstance();
            end.setTime(start.getTime());
            end.add(Calendar.DAY_OF_MONTH, 16);
            DateFormat df = new SimpleDateFormat("dd MMM");
            System.out.printf("start = %s  end = %s%n",
                               df.format(start.getTime()),
                               df.format(end.getTime()));
            // Calculate the number of days in between.
            Date difference = new Date(end.getTime().getTime() -
                                       start.getTime().getTime());
            Calendar c = Calendar.getInstance();
            c.setTime(difference);
            int days = c.get(Calendar.DAY_OF_MONTH);
            System.out.println("days = " + days);
            // Instantiate xVals.
            xVals = new int[days];
            // Prepare to count from start to end in days.
            int startDay = start.get(Calendar.DAY_OF_MONTH);
            int endDay = end.get(Calendar.DAY_OF_MONTH);
            Calendar counter = Calendar.getInstance();
            counter.setTime(start.getTime());
            // Initialize elements of xVals array.
            for(int j = 0; j < days; j++) {
                counter.add(Calendar.DAY_OF_MONTH, 1);
                xVals[j] = counter.get(Calendar.DAY_OF_MONTH);
            //System.out.printf("xVals = %s%n", Arrays.toString(xVals));
            // Instantiate yVals array and initialize its elements.
            yVals = new int[days];
            Random seed = new Random();
            for(int j = 0; j < yVals.length; j++) {
                yVals[j] = MIN + seed.nextInt(MAX-MIN+1);  // [50 - 100]
            //System.out.printf("yVals = %s%n", Arrays.toString(yVals));
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            int w = getWidth();
            int h = getHeight();
            double xInc = (double)(w - 2*PAD)/(xVals.length-1);
            double yInc = (double)(h - 2*PAD)/(MAX - MIN);
            //System.out.printf("xInc = %.1f  yInc = %.1f%n", xInc, yInc);
            // Origin of graph:
            double x0 = PAD;
            double y0 = h-PAD;
            // Draw ordinate.
            g2.draw(new Line2D.Double(PAD, PAD, PAD, h-PAD));
            // Draw tick marks.
            for(int j = MAX-MIN; j >= 0; j -= 10) {
                double y = y0 - j*yInc;
                g2.draw(new Line2D.Double(x0, y, x0-2, y));
            // Label ordinate.
            Font font = g2.getFont();
            FontRenderContext frc = g2.getFontRenderContext();
            LineMetrics lm = font.getLineMetrics("0", frc);
            float height = lm.getAscent() + lm.getDescent();
            for(int j = 0; j <= MAX-MIN; j += 10) {
                String s = String.valueOf(j+MIN);
                float width = (float)font.getStringBounds(s, frc).getWidth();
                float x = (PAD - width)/2;
                float y = (float)(y0 - j*yInc + lm.getDescent());
                g2.drawString(s, x, y);
            // Draw abcissa.
            g2.draw(new Line2D.Double(PAD, h-PAD, w-PAD, h-PAD));
            // Draw tick marks.
            for(int j = 0; j < xVals.length; j++) {
                double x = PAD + j*xInc;
                g2.draw(new Line2D.Double(x, y0, x, y0+2.0));
            // Label abcissa with xVals.
            float sy = h - PAD + (PAD + height)/2 - lm.getDescent();
            for(int j = 0; j < xVals.length; j++) {
                String s = String.valueOf(xVals[j]);
                float width = (float)font.getStringBounds(s, frc).getWidth();
                float x = (float)(PAD + j*xInc - width/2);
                g2.drawString(s, x, sy);
            // Plot data.
            g2.setPaint(Color.red);
            for(int j = 0; j < yVals.length; j++) {
                double x = x0 + j*xInc;
                double y = y0 - (yVals[j] - MIN)*yInc;
                g2.fill(new Ellipse2D.Double(x-1.5, y-1.5, 4, 4));
        public static void main(String[] args) {
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.add(new PlottingData());
            f.setSize(400,400);
            f.setLocation(200,200);
            f.setVisible(true);
    }

  • How to create a front panel display that lights up with different colours depending on its input signal?

    I am doing a project where I have this array which has different voltage outputs for each grid. How do I create a front panel object that lights up with different colours depending on the voltage input or is there already such a pre-built function?
    In addition, I wish to display these in an array on screen. Is there any pre-built function for this?

    Repulse wrote:
    I am doing a project where I have this array which has different voltage outputs for each grid. How do I create a front panel object that lights up with different colours depending on the voltage input or is there already such a pre-built function?
    The simplest way would be an intensity graph. It gives you a 2D grid where each grid point is colored according to the value of a 2D array. The Z axis color ramp determines the color.
    My second choice would be an array of colorboxes. (They could even be made to look like LEDs (see image, if course you can leave them square too), All you need is a scaling function thap maps voltages into a color ramp lookup table with an 8bit index)
    (Using booleans and color property nodes is relatively clumsy. Booleans are meant for two states because the value is boolean. Since array elements can only differ in value, and not in properties, it will not even work. Color boxes have a color data type which is much more appropriate for this case)
    LabVIEW Champion . Do more with less code and in less time .

  • Graph Quadrant Colour/Conditional Formatting

    Hi Experts,
    I have scatter graphs representing the % growth YoY (Y axis) and MoM (X axis.)
    Due to the variable percentages, the axis are not fixed and the scales on various graphs are different.
    There is a requirement to colour the quadrants of the graphs with the top right being green, top left amber, bottom right orange and bottom left red.
    Alternatively, the points can be coloured/changed based on which quadrant they are in.
    Can anybody help?
    Kind Regards,

    Thanks for the help but this does not give the desired effect.
    The entire quadrants need to be coloured or the points within that quadrant coloured.
    This is because the points on the graph vary to an extent that one graph may show ve X, ve Y, another, -ve X, -ve Y.
    Should there be a way to conditionally format the points such as they are a particular shape/colour depending on whcih quadrant they are in, is there a way to label the points on the graph with the same labels in the legend, thus ensuring that there can be no confusion over what each point represents?
    Any ideas/help would be greatly appreciated.
    Kind Regards,

  • Iam using a table in numbers to plot daily graph lines. If I fill a cell with a text box  at say zero it plots the graph. I can't actually set the cell value until the actual day but the graph plots it at zero when I don't want it to plot anything. Is tho

    I am using a table in Numbers to plot daily graph lines. Mood swings of how I am on the day, i"m a depressive.
    If I fill a cell with a step box at say zero it plots the graph. I can't actually set the cell value until the actual day but the graph plots it at zero when I don't want it to plot anything. Is there a work around. so thatbgraph only plots on the day?

    The answer is (sort of) in your subject, but edited out of the problem statement in the body of your message.
    When you use a stepper or a slider, the value in the cell is always numeric, and is always placed on the chart if that cell is included in the range graphed by the chart.
    But if you use a pop-up menu cell, you can specify numeric or text values in the list of choices for in the menu. Numeric values will be shown on the chart. Text values will not.
    For the example, the values list for the pop-up menu was:
    5
    3
    1
    Choose
    -1
    -3
    -5
    The first pop-up was set to display Choose, then the cell was filled down the rest of the column. Any text value (including a single space, if you want the cell to appear blank) may be used instead of Choose.
    For charts with negative Y values, the X axis will not automatically appear at Y=0. If your value set will include negative values, I would suggest setting the Y axis maximum and minimum to the maximum and minimum values on your menu list, rather than letting Numbers decide what range to include on the chart. Place a line shape across the chart at the zero level, and choose to NOT show the X axis.
    Regards,
    Barry

  • Needs to plot the values in x-axis linearly in obiee

    Hello all,
    I am trying to plot the values in x-axis linearly .
    Actual it should be starting at -100,-50,0,50,100,150,200,250,300,350,400,450........
    But now in my graph it is showing -100,-50,-25,-10,-1,+1,+25,+50,+100,+150..
    Can you please suggest me, how to achieve the actual values in x-axis.
    and also all the questions related to these situation.
    Thanking all.
    Thanks.

    Hi Luis,
    find attached an example ( maybe not easy to understand); but you can cut it and reuse it for
    your needs. Hope it helps.
    regards
    Werner
    Attachments:
    test_sweep.zip ‏108 KB

  • When I open my Colour Picker, the middle block (which normally shows the colour in a gradient of shades) is just a solid colour depending on which H, S, B, R, G, B I have selected. How do I revert it back to normal?

    When I open my Colour Picker, the middle block (which normally shows the colour in a gradient of shades) is just a solid colour depending on which H, S, B, R, G, B I have selected. How do I revert it back to normal?

    Becky,
    It seems that  the issue is caused by a corrupt folder called en_US or similar (depending on language) within the Adobe Illustrator 18 Settings folder, see post #7 by Jules in this thread,
    https://forums.adobe.com/thread/1595766
    so the solution should be to move or rename that folder (or the whole Adobe Illustrator 18 Settings folder).
    You can find the folder in Move the folder (follow the link with that name) with Illy closed.
    As a temporary roundabout way, you can select the lower rectangle to the right of the rainbow and DoubleClick to apply that to change the top rectangle and the values: the lower colour is the right one.

  • 3D graph plot properties - cannot be changed

    Hi all,
    I still cannot change the plot properties of the 3D graph.  I open the Plot Properties tab up and it gets stuck on the first page.
    This means that I cannot release any VIs which use the 3D graph - a big problem.
    Has anyone else experience this?  What do you suggest to fix it.
    Thanks,
    Battler.

    I have experienced exactly the same behavior (can not change 3D graph plot properties) with 3D plots (scatter and surface) in LabVIEW 2011.  The 3D plot properties page works correctly at first but then fails to switch pages after larger data sets have been loaded to the graph.  For example, my scatter graph contains 13 plots, each with 320 points of data.  Once the page "gets stuck" it is stuck for all 3D graphs until the offending graph is deleted and re-created.  To reproduce this issue create at least one 3D plot with a large number of plots in it.
    On a related note, if there was a programmatic method for deleting plots from a 3D graph then it's possible that this issue could be worked around.

  • How can i remember array, a using after next time in graph plot

    Hello i have a two graph , first graph case 'AF' consist with 3 arrays a second graph case 'BF' consist with 3 arrays + i need arrays of case 'AF', how can i do it? I have attached example.
    Thanks
    Attachments:
    0408 (16A) v jednom CASE.vi ‏398 KB

    Hi,
    If i have understood you right, you want to save the AF graph plots.
    am i right? if not plz correct me.
    If i got u right, the simplest is to build a 2 D array by merging your 1D arrays and write to spreadsheeet file.
    Now, you can read it whenever u want and display on the XY graph.
    hope this help, if not, plz eloberate on what you are looking for.
    Regards
    Dev

  • Changing Graph Plot Legend

    I have no problem changing a normal graphs plot legend with a property node, but I'm trying to display three different sets of data on one graph.  I tried doing it using a plot reference with the Plot Legend and using Caption Text.  They should be settable when the VI is running, but the way I was trying to do it I got a reference error (1055 Reference Invalid).  Setting either the Plot Legend or Caption Text would be acceptable if I could just figure it out.
    I'm trying to display 32 spectrums, but only use 8 graphs and have the name of the particular channel change.  Doing this without doing an FFT the channel name gets brought into the graph, but when I use the Power Spectrum VI I don't have the Spectrum Info wired into anything.  So, I'm bringing my original channel name array over and trying to do an iteration to pick the correct plot reference and channel name.
    I've extracted only the part of my code for this question, so hopefully it is easy to look at what I'm doing.
    The first VI and SubVI are functional.  The second SubVI is where I was attempting to change the Caption Text.  I've tried other things too, but I just wanted to show one way I was attempting to do it.
    Solved!
    Go to Solution.
    Attachments:
    Part of Analyzer - Displaying Graph Legend.vi ‏1432 KB
    Calc Channel Indices 1_35.vi ‏27 KB

    I don't have the SV add on so I can't check out your main program. I looked at your sub vi and you're doing more code than you need to. Take a look at my example, I've put your 8 graphs into a cluster then used an array of references along with arrays for your chanel indecies. Maybe it can give you some ideas for your program.
    Attachments:
    Calc Channel Indices 1_35 mod.vi ‏766 KB

  • Change order of wpf graph plots

    I'm trying to solve following issue. Let's say I'm sampling data once per second and showing it on the graph. I want to show history of the data, say last 20 plots using the same color with fading. What I do now:
    - create 21 plots, say Plots[0]..Plots[20] 
    - at meas 1, set Data[0] = data
    - set Plots[0] opacity to 1
    - at meas 2, set Data[1] = data
    - set Plots[1] opacity to 1, Plots[0] opacity to 0.5
    - at meas 3, set Data[2] = data
    - set Plots[2] opacity to 1, Plots[1] opacity to 0.6, Plots[0] opacity to 0.3
    - at meas 21, set Data[20] = data
    - set opacity to 0.1..1
    // we're fine as of now, here comes the tricky part
    - at meas 22 I need to remove the data of meas 0 (stored at Data[0]) and replace it with the new data
    - so I set Data[0] = data
    - set Plots[0] opacity to 1 (it's the newest result)
    - set other plots opacity 0.1..0.9
    // and here is the problem: Plots[0] is now at the bottom of the plot stack and is covered by 20 other plots, thus is barely visible
    so I somehow need to move Plots[0] to the top of the stack
    I've tried removing Plot and Data of the farthest plot and adding creating plot with the most recent data, but it leads to incorrect indices (Plot.Index grows all the time, but Data array stays the same)
    Another option would be to fix plots order and opacity in advance, and change data for all plots all the time. But I assume this would be very slow (think of 20-50 copies of the plot with say 1000 points).
    So, any bright ideas here?

    Idea 1) Pre-allocate all of the fade plots, use BeginInit/EndInit when updating the Data collection, and always apply the newest data to the last plot. In pseudo-code:
        // initial setup
        for( opacity = 0..1 )
            var renderer = new Renderer( opacity )
            graph.Plots.Add( new Plot { Renderer = renderer } )
        // on data update
        graph.BeginInit()
        for( i = 1..graph.Data.Count )
            graph.Data[i - 1] = graph.Data[i] /* shift old data down */
        graph.Data[20] = /* assign new data to the last plot */
        graph.EndInit()
    Idea 2) If you just want the historic data visible in the graph (i.e. you do not need to query or interact with the old data through the graph), and if your range is stable, then you could have one plot in the graph and use a PhosphorColorRamp to get the visual fade effect. In pseudo-code:
        // initial setup
        var brush = new SolidColorBrush( C )
        Graph.SetPhosphorMode( brush, Immediate )
        graph.Plots.Add( new Plot { Renderer = new Renderer( brush ) } )
        graph.RenderMode = Raster
        graph.PhosphorColorRamp = new FadeRamp { Color = C, Duration = 20, DurationKind = Frames }
        // on data update
        graph.Data[0] = /* assign new data to first plot */
    (Note that the phosphor effect is one of the areas being updated, so the syntax will be changing in the next release of Measurement Studio.)
    ~ Paul H

  • Printing graph plot only no background graph

    Hi
    I can able to print total graph ok.
    But i want to print graph plot only no backgroung.
    how can i do it.
    Regards,
    hari

    Check the attached example (created in LabVIEW 9.0f3).
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.
    Attachments:
    Example.vi ‏13 KB

  • Bode plot instrument reading differs when compared to grapher plot

    Good Day,
    Need some help to understand why the bode plot instrument plot (clicking the instrument to see plot) is different from the grapher plot when run in "simulate >>> analysis >>> AC analysis >>> vertical scale (db) >>> simulate.
    Problem happens if the AC source AC analysis magnitude is changed from 1(default) to another value. i.e 6.
    Please help advise, it seems the bode plotter is only considering the default AC analysis default magnitude value of 1?.
    Appreciate comment on this. Thank you
    The circuit being simulated is AC source connected to an RLC circuit and Vo is accross C. L and C assume some small series resistances.

    Hi educ,
    In the AC Analysis I set the stop frequency to 100 KHz which is the stop frequency of the Bode Plotter instrument. When I ran the analysis after doing this and compared it to the bode plotter, it was a nearly identical output. Try to configure the start and stop frequency to match in the AC Analysis and in the Bode Plotter and you should see much better results.
    Regards,
    Tayyab R,
    National Instruments.

  • Graph plot in labview to get time in seconds or minutes in X axis starting from 0.

    How can we obtain time starting from 0 seconds or 0 minutes on X axis in a chart and XY graph in labview.When I plot it is showing the system time on   X axis.I would prefer the time to start from 0 ( seconds) , rather than system time.Please reply.

    I have NI cDAQ 9174 chasis and NI 9211 and NI 9207 for thermocouple (NI 9211) and current (NI 9207).Can I acquire all three data inputs within a single DAQ Assistant express vi.Because I tried to access all 3 in one DAQ Assisstant , but it was not accepting it.So I had to place one DAQ Assisstant for thermocouple readings and another for current.For reference I have attached my labview diagram.
    Attachments:
    rktr3.vi ‏218 KB

Maybe you are looking for

  • Error message with Vista and 7.2: Windows-No Disk Exception Processing Mess

    I just got a new Dell computer with Windows Vista and I am trying to put iTunes on it. I can install it fine from the original CD, and then I am prompted to update it to 7.2. After updating, this is the message that I get: Windows-No Disk, Exception

  • Cannot install CS3 Extended - AT ALL.

    I bought CS3 Extended for Mac at the Apple store. Nevermind that I went in for CS4 Extended and had waited to buy that version - the person either didn't know the difference or didn't care, and someone else opened the box when I got home.  So I guess

  • Photoshop CS5 crashes when opening file/creating new file

    I can load up CS5 and its fine. I then go to open or create a file and it just crashes. Can someone help me please I really need photoshop for my photography Cheers Lunty

  • Satellite L505D Turn off Touch Pad While Typing

    This laptop is maddenning to post on forums with etc. because when typing I bump the mousepad and or one of the buttons and loose everything that I have typed.  I don't think this is the original install of Windows7 via Toshiba because I cannot find

  • Everything plays in Pro Logic.

    I bought a X-Fi Titanium today. I've spent the past seven hours trying to get it to play sound in anything other than Pro Logic mode. I have a Yamaha home theater with an optical cable plugged in to the digital out port of the card. I tried everythin