Skip to main content
Bounty Ended with 50 reputation awarded by kjo
Erased undesired axis
Source Link
Carl Woll
  • 131.7k
  • 6
  • 246
  • 359

I modified my previous answer to work better with datasets of different length. I rely on the AspectRatio being GoldenRatio. If it isn't, replace GoldenRatio with the appropriate AspectRatio. I also use 3.6 as the width to height ratio of the barcode.

edited to paint over axis below barcodes

makeInset[i_,n_] := Inset[
    Graphics[barcode[i]],
    Scaled[{-0.02,0},{0,i}],
    {0,0},
    Scaled[{3.6,1}/n]
];

bplot[data_] := With[{n = Length[data]},
    Framed[
        BarChart[
                data,
                ChartLabels->None,
                ChartStyle->LightGray,
                BarOrigin->Left,
                PlotRangePadding->{{Scaled[3.6 / (n*GoldenRatio)],0},{0,0}},
                ImageSize->250,
                Epilog->Table[makeInset[i>{
                    White,
                    Rectangle[Scaled[{-1,-1}, {0, 0}], Scaled[{-.02, 1}, {0, 0}]],
                    Table[makeInset[i,n],{i,n}]
                }
            ],
        FrameStyle->Thin
    ]
]

A couple examples:

bplot[data]

enter image description hereenter image description here

bplot[data[[;;5]]]

enter image description hereenter image description here

The basic idea is to use a scaled inset size, and then increase the PlotRangePadding to accommodate the addition of the barcodes.

I modified my previous answer to work better with datasets of different length. I rely on the AspectRatio being GoldenRatio. If it isn't, replace GoldenRatio with the appropriate AspectRatio. I also use 3.6 as the width to height ratio of the barcode.

makeInset[i_,n_] := Inset[
    Graphics[barcode[i]],
    Scaled[{-0.02,0},{0,i}],
    {0,0},
    Scaled[{3.6,1}/n]
];

bplot[data_] := With[{n = Length[data]},
    Framed[
        BarChart[
                data,
                ChartLabels->None,
                ChartStyle->LightGray,
                BarOrigin->Left,
                PlotRangePadding->{{Scaled[3.6 / (n*GoldenRatio)],0},{0,0}},
                ImageSize->250,
                Epilog->Table[makeInset[i,n],{i,n}]
            ],
        FrameStyle->Thin
    ]
]

A couple examples:

bplot[data]

enter image description here

bplot[data[[;;5]]]

enter image description here

The basic idea is to use a scaled inset size, and then increase the PlotRangePadding to accommodate the addition of the barcodes.

I modified my previous answer to work better with datasets of different length. I rely on the AspectRatio being GoldenRatio. If it isn't, replace GoldenRatio with the appropriate AspectRatio. I also use 3.6 as the width to height ratio of the barcode.

edited to paint over axis below barcodes

makeInset[i_,n_] := Inset[
    Graphics[barcode[i]],
    Scaled[{-0.02,0},{0,i}],
    {0,0},
    Scaled[{3.6,1}/n]
];

bplot[data_] := With[{n = Length[data]},
    Framed[
        BarChart[
                data,
                ChartLabels->None,
                ChartStyle->LightGray,
                BarOrigin->Left,
                PlotRangePadding->{{Scaled[3.6 / (n*GoldenRatio)],0},{0,0}},
                ImageSize->250,
                Epilog->{
                    White,
                    Rectangle[Scaled[{-1,-1}, {0, 0}], Scaled[{-.02, 1}, {0, 0}]],
                    Table[makeInset[i,n],{i,n}]
                }
            ],
        FrameStyle->Thin
    ]
]

A couple examples:

bplot[data]

enter image description here

bplot[data[[;;5]]]

enter image description here

The basic idea is to use a scaled inset size, and then increase the PlotRangePadding to accommodate the addition of the barcodes.

Grammar
Source Link
Carl Woll
  • 131.7k
  • 6
  • 246
  • 359

I modified my previous answer to work better with datasets of different length. I rely on the AspectRatio being GoldenRatio. If it isn't, replace GoldenRatio with the appropriate AspectRatio. I also use 3.6 as the width to height ratio of the barcode.

makeInset[i_,n_] := Inset[
    Graphics[barcode[i]],
    Scaled[{-0.02,0},{0,i}],
    {0,0},
    Scaled[{3.6,1}/n]
];

bplot[data_] := With[{n = Length[data]},
    Framed[
        BarChart[
                data,
                ChartLabels->None,
                ChartStyle->LightGray,
                BarOrigin->Left,
                PlotRangePadding->{{Scaled[3.6 / (n*GoldenRatio)],0},{0,0}},
                ImageSize->250,
                Epilog->Table[makeInset[i,n],{i,n}]
            ],
        FrameStyle->Thin
    ]
]

A couple examples:

bplot[data]

enter image description here

bplot[data[[;;5]]]

enter image description here

The basic idea is to use a scaled inset size, and then increase the PlotRangePadding to accommodate the addition of the barcodes.

I modified my previous answer to work better with datasets of different length. I rely on the AspectRatio being GoldenRatio. If it isn't replace GoldenRatio with the appropriate AspectRatio. I also use 3.6 as the width to height ratio of the barcode.

makeInset[i_,n_] := Inset[
    Graphics[barcode[i]],
    Scaled[{-0.02,0},{0,i}],
    {0,0},
    Scaled[{3.6,1}/n]
];

bplot[data_] := With[{n = Length[data]},
    Framed[
        BarChart[
                data,
                ChartLabels->None,
                ChartStyle->LightGray,
                BarOrigin->Left,
                PlotRangePadding->{{Scaled[3.6 / (n*GoldenRatio)],0},{0,0}},
                ImageSize->250,
                Epilog->Table[makeInset[i,n],{i,n}]
            ],
        FrameStyle->Thin
    ]
]

A couple examples:

bplot[data]

enter image description here

bplot[data[[;;5]]]

enter image description here

The basic idea is to use a scaled inset size, and then increase the PlotRangePadding to accommodate the addition of the barcodes.

I modified my previous answer to work better with datasets of different length. I rely on the AspectRatio being GoldenRatio. If it isn't, replace GoldenRatio with the appropriate AspectRatio. I also use 3.6 as the width to height ratio of the barcode.

makeInset[i_,n_] := Inset[
    Graphics[barcode[i]],
    Scaled[{-0.02,0},{0,i}],
    {0,0},
    Scaled[{3.6,1}/n]
];

bplot[data_] := With[{n = Length[data]},
    Framed[
        BarChart[
                data,
                ChartLabels->None,
                ChartStyle->LightGray,
                BarOrigin->Left,
                PlotRangePadding->{{Scaled[3.6 / (n*GoldenRatio)],0},{0,0}},
                ImageSize->250,
                Epilog->Table[makeInset[i,n],{i,n}]
            ],
        FrameStyle->Thin
    ]
]

A couple examples:

bplot[data]

enter image description here

bplot[data[[;;5]]]

enter image description here

The basic idea is to use a scaled inset size, and then increase the PlotRangePadding to accommodate the addition of the barcodes.

Accommodate different sized datasets.
Source Link
Carl Woll
  • 131.7k
  • 6
  • 246
  • 359

You're mostI modified my previous answer to work better with datasets of different length. I rely on the way thereAspectRatio being GoldenRatio. Here are a couple tweaks:If it isn't replace GoldenRatio with the appropriate AspectRatio. I also use 3.6 as the width to height ratio of the barcode.

makeInset[i_]makeInset[i_,n_] :=Inset[Graphics[barcode[i]]= Inset[
    Graphics[barcode[i]],
    Scaled[{-0.02,0},{0,i}],
    {0,0},
    Scaled[{3.1]];6,1}/n]
];

bplot[data_] := With[{n = Length[data]},
    Framed[
        BarChart[
                data,
                ChartLabels->None,
                ChartStyle->LightGray,
                BarOrigin->Left,
                PlotRangePadding->{{Scaled[Scaled[3.12]6 / (n*GoldenRatio)],0},{0,0}},
                ImageSize->250,
                Epilog->Table[makeInset[i]>Table[makeInset[i,n],{i,Length[data]n}]
            ],
        FrameStyle->Thin
    ]
]

enter image description here A couple examples:

bplot[data]

enter image description here

bplot[data[[;;5]]]

enter image description here

The basic idea is to use Scaled[.1] as the size of thea scaled inset size, and then increase the PlotRangePadding to accommodate the addition of the barcodes. I use a PlotRangePadding of Scaled[.12] to account for both the Scaled[{-.02, 0}, {0, i}] position of the inset, as well as the Scaled[.1] size of the inset.

You're most of the way there. Here are a couple tweaks:

makeInset[i_]:=Inset[Graphics[barcode[i]],Scaled[{-0.02,0},{0,i}],{0,0},Scaled[.1]];

Framed[
    BarChart[
        data,
        ChartLabels->None,
        ChartStyle->LightGray,
        BarOrigin->Left,
        PlotRangePadding->{{Scaled[.12],0},{0,0}},
        ImageSize->250,
        Epilog->Table[makeInset[i],{i,Length[data]}]
    ],
    FrameStyle->Thin
]

enter image description here

The basic idea is to use Scaled[.1] as the size of the inset, and then increase the PlotRangePadding to accommodate the addition of the barcodes. I use a PlotRangePadding of Scaled[.12] to account for both the Scaled[{-.02, 0}, {0, i}] position of the inset, as well as the Scaled[.1] size of the inset.

I modified my previous answer to work better with datasets of different length. I rely on the AspectRatio being GoldenRatio. If it isn't replace GoldenRatio with the appropriate AspectRatio. I also use 3.6 as the width to height ratio of the barcode.

makeInset[i_,n_] := Inset[
    Graphics[barcode[i]],
    Scaled[{-0.02,0},{0,i}],
    {0,0},
    Scaled[{3.6,1}/n]
];

bplot[data_] := With[{n = Length[data]},
    Framed[
        BarChart[
                data,
                ChartLabels->None,
                ChartStyle->LightGray,
                BarOrigin->Left,
                PlotRangePadding->{{Scaled[3.6 / (n*GoldenRatio)],0},{0,0}},
                ImageSize->250,
                Epilog->Table[makeInset[i,n],{i,n}]
            ],
        FrameStyle->Thin
    ]
]

A couple examples:

bplot[data]

enter image description here

bplot[data[[;;5]]]

enter image description here

The basic idea is to use a scaled inset size, and then increase the PlotRangePadding to accommodate the addition of the barcodes.

Source Link
Carl Woll
  • 131.7k
  • 6
  • 246
  • 359
Loading