dp = DiscretePlot[PrimePi[k], {k, 1, 10},
PlotStyle -> PointSize[Large], Frame -> True,
FrameLabel -> {"A", "B"}]
1. To make the filling lines go from the vertical axis the the points (without changing the coordinates of points), you can post-process to modify the lines:
Show[dp /. Line[a : {__List}, c__] :> {Gray,
Line[a /. {{x1_, y1_}, {x2_, y2_}} :> {{x1, y1}, {0, y1}}]},
PlotRange -> All, Axes -> False]
2. To flip the vertical and horizontal axes, you can use
Show[MapAt[GeometricTransformation[#, ReflectionTransform[{-1, 1}]] &, dp, {1}],
PlotRange -> All, AxesOrigin -> {0, 0}, FrameLabel -> {"B", "A"}]
Update: You can also use BubbleChart
and add the horizontal lines as Prolog
:
SeedRandom[1]
lists = {{#, RandomInteger[{1, 5}]} & /@
Sort[RandomSample[Range[15]], 10], {#, RandomInteger[{1, 5}]} & /@
Sort[RandomSample[Range @ 15], 7]};
bcdata = lists /. {x_?NumericQ, y_?NumericQ} :>
Labeled[{y, x, 1}, Style[y, 16, Italic, Black], Center];
BubbleChart[bcdata,
ChartStyle -> {RGBColor[1, 0.4, 0.4], RGBColor[0., 0.75, 0.75]},
ImageSize -> Large, BubbleSizes -> {.06, .06},
ChartElementFunction -> "SphereBubble",
GridLinesStyle -> LightGray, GridLines -> All,
Prolog -> {AbsoluteThickness[5], Gray, Line[{{0, #[[1]]}, Reverse@#}] & /@
KeyValueMap[List][GroupBy[Join @@ lists, First -> Last, Max]]}]
Show[MapAt[# /. v_ /; VectorQ[v, NumberQ] :> Reverse[v] &, DiscretePlot[PrimePi[k], {k, 1, 10}], 1], AspectRatio -> GoldenRatio, AxesOrigin -> {0, 0}, PlotRange -> All]
$\endgroup$