Coder Social home page Coder Social logo

Comments (9)

vadimnazarov avatar vadimnazarov commented on July 2, 2024 2

Hi @peter-yufan-zeng

  1. In order to re-shuffle in the left relative abundance plot (per-sample), you can provide just the names of the datasets (in this example I provide them in a random order):
data(immdata)
p <- repClonality(immdata$data, "homeo") %>% vis()
p <- p + scale_x_discrete(limits= sample(names(immdata$data), length(immdata$data), FALSE))
p
  1. Regarding the second plot. Our team will work on the more powerful ordering, thank you! I will leave this issue open until we implement this. You provided a very good workaround, thank you! And using functions such as scale_x_discrete it is possible to rename group names in the legend and of x/y axis.

from immunarch.

vadimnazarov avatar vadimnazarov commented on July 2, 2024 1

Hi @peter-yufan-zeng

Yes, it is possible using the ggplot2 scale_x_discrete function. Here is the example using the data from the package

data(immdat)
p = repDiversity(immdata$data) %>% vis("Status", immdata$meta)
p + scale_x_discrete(limits = c("MS", "C"))

from immunarch.

peter-yufan-zeng avatar peter-yufan-zeng commented on July 2, 2024 1

Oh i did find a crude way around this problem. It seems that the order is based on default alphabetical order, so i just made a new column in .meta and assigned "A", "B","C" to the samples in the order I want them to be, which would then output in the right order.

from immunarch.

vadimnazarov avatar vadimnazarov commented on July 2, 2024

This link might help: http://www.cookbook-r.com/Graphs/Axes_(ggplot2)/

from immunarch.

peter-yufan-zeng avatar peter-yufan-zeng commented on July 2, 2024

Hi @vadimnazarov thanks for your answer. After my post I used the exact same method to fix the ordering. However, the problem I have is with the Relative Abundance figures (ex. this one you had on your website), where scale_x_discrete no longer works.

image

from immunarch.

vadimnazarov avatar vadimnazarov commented on July 2, 2024

Hi @peter-yufan-zeng

can you please provide an R code that you use to do that? Including the repClonality part

from immunarch.

vadimnazarov avatar vadimnazarov commented on July 2, 2024

Ping about the sample order on figures @peter-yufan-zeng

from immunarch.

peter-yufan-zeng avatar peter-yufan-zeng commented on July 2, 2024

repClonality(immdata.opc.bcr$data, .method = "homeo", .clone.types = c(Small = .001, Medium = .01, Large = .1, Hyperexpanded = 10)) %>% vis(., .by=c("cluster_order"),.meta=immdata.opc.bcr$meta)+ labs(title = "",subtitle = "") + theme_classic()+ theme(axis.text.x=element_text(angle=45, hjust=1),legend.position = "none") + scale_fill_manual(values = c("Immune Rich" = "#3B4992FF","Mixture"="#EE0000FF","Immune Dessert"="#008B45FF"))+ scale_x_discrete(limits=c("Immune Rich","Mixture","Immune Desert"))+ xlab("") + ylab("Relative abundance (%)")

This is where it breaks down - likely because the x-axis in the right figure is (small, medium, large, hyperexpanded, etc.)

from immunarch.

vadimnazarov avatar vadimnazarov commented on July 2, 2024

Thank you, I will look into it!

from immunarch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.