Draw a rectangle but X and Y are in the same columnI 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
Data Exploration and VisualizationRe: Draw a rectangle but X and Y are in the same columnHow 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)
Re: Draw a rectangle but X and Y are in the same columnEssentially 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.
Re: Draw a rectangle but X and Y are in the same columnGraph 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);

Re: Draw a rectangle but X and Y are in the same columnHere 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 );

Re: Draw a rectangle but X and Y are in the same columnThank 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?
Thank you
Re: Draw a rectangle but X and Y are in the same columnIt can be done in graph builder. How it could/should be done depends on how much are you willing to modify your data table (splitting, stacking, creating new columns, ...)?
Re: Draw a rectangle but X and Y are in the same columnIdeally leaving the table as is. I know it can be done by changing the table, as shown in the thread I linked, but I was wondering if it can be done with this kind of table structure.
Re: Draw a rectangle but X and Y are in the same columnIn your latest example of your data structure
ID Parameter Value
1 X size 10
1 Y size 15
2 X size 11
2 Y size 14
I believe you are specifying the dimensions of the rectangles to be drawn. Where are the data points to be drawn on the Graph Builder. The rectangles can be added to Graph Builder using <