I need to draw some rectangles, similarly to what is shown in this reply
In my case i have data organized differently:
Parameter Value
X 1
Y 2
Is there a simple way withouth splitting the row in X and Y columns?
Thank you
How are different coordinates mapped together (how do you know which X belongs to which Y)? How does your more full data look like (difficult to create a rectangle with just one? coordinate)? What type of rectangle do you need? Graph Builder? Graph Box?
Easiest way would most likely be splitting but there could be other methods (maybe some simple and some not simple)
Essentially I have a table similar to this:
ID Parameter Value
1 X size 10
1 Y size 15
2 X size 11
2 Y size 14
And i want to superimpose graphically the two rectangles in order to compare the dimensions.
Graph Box with Rect is one option if you just want to see the rectangles
Names Default To Here(1); nw = New Window("Example", gb = Graph Box( Frame Size(300, 300), Pen Size(1); Pen Color("Blue"); Rect(0, 15, 10, 0); Pen Color("Green"); Rect(0, 11, 14, 0); ) ); nw[AxisBox(1)] << Min(-0.1) << Max(15.1) << Inc(1); nw[AxisBox(2)] << Min(-0.1) << Max(1.1) << Inc(1);
Here is a simple expansion on Jarmo's example. I simply moved away from hardcoding the values, to using the data table values directly.
Names Default To Here( 1 ); dt = New Table( "Example", Add Rows( 4 ), New Column( "ID", Character, "Nominal", Set Values( {"1", "1", "2", "2"} ) ), New Column( "Parameter", Character, "Nominal", Set Values( {"X size", "Y size", "X size", "Y size"} ) ), New Column( "Value", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [10, 15, 11, 14] ) ) ); nw = New Window( "Example", gb = Graph Box( Frame Size( 300, 300 ), Pen Size( 1 ); Pen Color( "Blue" ); Rect( 0, dt:value[2], dt:value[1], 0 ); Pen Color( "Green" ); Rect( 0, dt:value[4], dt:value[3], 0 ); ) ); nw[AxisBox( 1 )] << Min( -0.1 ) << Max( 15.1 ) << Inc( 1 ); nw[AxisBox( 2 )] << Min( -0.1 ) << Max( 12.1 ) << Inc( 1 );
Thank you very much; I adapted the script to my table and it works.
Is there any way to do it via the graph build so that i can maybe add labels, filters, etc?