Help changing the visualization of my figures

Hello, i’m ploting these two figures:

fluxo_harm_multipla3 fluxo_harm_naomultipla3

Using this code:

using StatPlots

Nt = 33;

DHTvI = [0.948922; 1.84699; 2.33009; 2.82551; 3.35778; 4.14989; 4.70336; 5.57; 6.16913; 6.5514; 6.5514; 2.27957; 2.88751; 3.20105; 3.20105; 3.38961; 3.42008; 3.45269; 3.46789; 3.48355; 3.50024; 3.51735; 3.53834; 3.55256; 3.56152; 3.56152; 4.15358; 4.15728; 4.16099; 6.16913; 6.16913; 6.16913; 6.16913];

DHTvI_filtro = [0.916418; 1.78372; 2.22713; 2.68392; 3.17623; 3.9166; 4.43431; 5.24547; 5.82063; 6.18936; 6.18784; 2.21456; 2.82132; 3.13448; 3.13448; 3.20636; 3.2352; 3.2661; 3.28053; 3.29539; 3.31124; 3.32749; 3.34743; 3.36094; 3.36946; 3.36946; 3.92007; 3.92355; 3.92704; 5.82062; 5.82062; 5.82062; 5.82062];

DHTv3 = [0.906961; 1.76531; 2.27702; 2.7787; 3.30602; 4.21055; 4.83374; 5.79876; 6.46096; 6.88203; 6.88203; 2.21223; 2.85706; 3.19324; 3.19324; 3.32349; 3.34032; 3.35847; 3.36702; 3.37584; 3.38529; 3.39499; 3.40694; 3.41507; 3.4202; 3.4202; 4.21269; 4.21482; 4.21697; 6.46096; 6.46096; 6.46096; 6.46096];

DHTv3_filtro = [0.755687; 1.47087; 1.80179; 2.14541; 2.51801; 3.12647; 3.54846; 4.2059; 4.66503; 4.95754; 4.86841; 1.92674; 2.58204; 2.9223; 2.9223; 2.53762; 2.55653; 2.5769; 2.58651; 2.59643; 2.60704; 2.61796; 2.63139; 2.64051; 2.64628; 2.64628; 3.12891; 3.13135; 3.13381; 4.66503; 4.66503; 4.66503; 4.66503];

    barras = repeat(["Antes","Depois"], inner = Nt)
    p1 = groupedbar([DHTv3 DHTv3_filtro], group = barras, xlabel = "Barra", ylabel = "DTT3 (%)", bar_position = :dodge, bar_width=0.7)
    plot(p1)
    savefig("fluxo_harm_multipla3")
    p2 = groupedbar([DHTvI DHTvI_filtro], group = barras, xlabel = "Barra", ylabel = "DTTI (%)", bar_position = :dodge, bar_width=0.7)
    plot(p2)
    savefig("fluxo_harm_naomultipla3")

I have two questions:

  1. How can i change the y-axis of the first figure to be equal the second one? i.e, showing 0,1,2,3,4,5 and 6, instead of 0,2,4 and 6;

  2. How can i move the “repeat” box showing the names “Antes” and “Depois” to the mid of my figures? Because as you can see, they are in the top right corner, above some of the bars i’m plotting.

Thanks in advance!

  1. You can use yticks!
  2. Specify the position with legend

Open Overview · Plots then Ctrl+F to search for keywords and try it out. :laughing:

1 Like

Ok, thanks for the info! I’m going to try those!